[jbosstools-issues] [JBoss JIRA] (JBDS-3682) Online installer reports missing package.js file
Jan Richter (JIRA)
issues at jboss.org
Thu Mar 17 04:52:00 EDT 2016
[ https://issues.jboss.org/browse/JBDS-3682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178271#comment-13178271 ]
Jan Richter commented on JBDS-3682:
-----------------------------------
The trouble is __dirname gets resolved depending on the main module's location. For the installer itself, it is in browser/ folder, for tests it seems to be wherever the currently loaded js file is.
So we get to the conflict where the app resolves the path as 'browser/../package.json' and tests as 'browser/pages/account/../package.json'.
Frankly, I'm out of ideas for elegant solutions - I have one that should work but it does not look so pretty:
- turn {noformat}__dirname + ../package.json{noformat} into {noformat}__dirname.substring(0, lastindexof('browser')) + package.json{noformat}
That should always resolve the path to the root folder (unless we plan to introduce another browser folder into the structure).
[~ppitonak], [~dgolovin] - any thoughts, comments on this?
> Online installer reports missing package.js file
> ------------------------------------------------
>
> Key: JBDS-3682
> URL: https://issues.jboss.org/browse/JBDS-3682
> Project: Developer Studio (JBoss Developer Studio)
> Issue Type: Bug
> Components: installer
> Affects Versions: 9.1.0.CR1
> Reporter: Denis Golovin
> Assignee: Denis Golovin
>
> Installer now files to load path.resolve('./package.json') file and fails, because file not found. In this case it tries to resolve from folder where installer started, which is a temp folder where electron installer unpacked all the files after start. package.json real location is in app subfolder which can be referenced by __pathname variable plus one level up.
> Right way to reference package json would be:
> {code}var pjson = require(path.join(__dirname,'../package.json'));{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jbosstools-issues
mailing list