Skip to content

Commit

Permalink
support Windows XP by working around lack of symlink support with ful…
Browse files Browse the repository at this point in the history
…l copies - refs #1096
  • Loading branch information
Dane Springmeyer committed Jan 7, 2012
1 parent a2d7efb commit 4bc1837
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
#!/usr/bin/env node

var fs = require('fs');

process.title = 'tilemill';

// This is necessary to make optimist not special-case into coffeescript as
// certain node installs (e.g. ubuntu node ppa) do not use `node` as the binary
// name.
process.argv[0] = 'node';

if (process.platform === 'win32') {

// HOME is undefined on windows
process.env.HOME = process.env.HOMEPATH;

// test for symlink support and fallback
// to full copying of files if lacking
try {
fs.symlinkSync('/tmp/from.txt','/tmp/to.txt');
} catch (err) {
if (err.code === 'ENOTSUP') {
fs.symlink = function(from,to,cb) {
try {
fs_utils.cprSync(from,to);
return cb();
} catch (err) {
return cb(err);
}
}
}
}
}

// Default --config flag to user's home .tilemill.json config file.
Expand Down

0 comments on commit 4bc1837

Please sign in to comment.