Skip to content

Commit 3fe2354

Browse files
committed
Creating an app from install works
1 parent 735b85d commit 3fe2354

2 files changed

Lines changed: 35 additions & 23 deletions

File tree

tools/files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ files.linkToExecutable = function (target, linkLocation) {
10311031
// script that calls the target passed in
10321032
var newScript = [
10331033
"@echo off",
1034-
"%~dp0\\" + target + ".bat" // XXX hack assuming we are linking to bat
1034+
"%~dp0\\" + target + ".bat %*" // XXX hack assuming we are linking to bat
10351035
].join(os.EOL);
10361036

10371037
fs.writeFileSync(linkLocation, newScript, {encoding: "ascii"});

tools/tropohouse.js

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -208,29 +208,41 @@ _.extend(exports.Tropohouse.prototype, {
208208
var downloadedArches = [];
209209
var packageLinkTarget = null;
210210

211-
try {
212-
packageLinkTarget = fs.readlinkSync(files.escapePathForWindows(packageLinkFile));
213-
} catch (e) {
214-
// Complain about anything other than "we don't have it at all". This
215-
// includes "not a symlink": The main reason this would not be a symlink
216-
// is if it's a directory containing a pre-0.9.0 package (ie, this is a
217-
// warehouse package not a tropohouse package). But the versions should
218-
// not overlap: warehouse versions are truncated SHAs whereas tropohouse
219-
// versions should be semver-like.
220-
if (e.code !== 'ENOENT')
221-
throw e;
222-
}
211+
// Huge special case here for Windows because the whole symlinking thing
212+
// doesn't work, so we just read isopack.json
213+
if (process.platform === "win32") {
214+
// XXX HACK HACK should refactor into isopack.js to read all of the
215+
// package formats, might be OK for preview? not sure
216+
var isopackJsonPath = path.join(packageLinkFile, "isopack.json");
217+
if (fs.existsSync(isopackJsonPath)) {
218+
var isopackJson = JSON.parse(fs.readFileSync(isopackJsonPath));
219+
downloadedArches = _.pluck(isopackJson["isopack-1"].builds, "arch");
220+
}
221+
} else {
222+
try {
223+
packageLinkTarget = fs.readlinkSync(files.escapePathForWindows(packageLinkFile));
224+
} catch (e) {
225+
// Complain about anything other than "we don't have it at all". This
226+
// includes "not a symlink": The main reason this would not be a symlink
227+
// is if it's a directory containing a pre-0.9.0 package (ie, this is a
228+
// warehouse package not a tropohouse package). But the versions should
229+
// not overlap: warehouse versions are truncated SHAs whereas tropohouse
230+
// versions should be semver-like.
231+
if (e.code !== 'ENOENT')
232+
throw e;
233+
}
223234

224-
if (packageLinkTarget) {
225-
// The symlink will be of the form '.VERSION.RANDOMTOKEN++web.browser+os',
226-
// so this strips off the part before the '++'.
227-
// XXX maybe we should just read the isopack.json instead of
228-
// depending on the symlink?
229-
var archPart = packageLinkTarget.split('++')[1];
230-
if (!archPart)
231-
throw Error("unexpected symlink target for " + packageName + "@" +
232-
version + ": " + packageLinkTarget);
233-
downloadedArches = archPart.split('+');
235+
if (packageLinkTarget) {
236+
// The symlink will be of the form '.VERSION.RANDOMTOKEN++web.browser+os',
237+
// so this strips off the part before the '++'.
238+
// XXX maybe we should just read the isopack.json instead of
239+
// depending on the symlink?
240+
var archPart = packageLinkTarget.split('++')[1];
241+
if (!archPart)
242+
throw Error("unexpected symlink target for " + packageName + "@" +
243+
version + ": " + packageLinkTarget);
244+
downloadedArches = archPart.split('+');
245+
}
234246
}
235247

236248
var archesToDownload = _.filter(options.architectures, function (requiredArch) {

0 commit comments

Comments
 (0)