This repository has been archived by the owner on Apr 4, 2019. It is now read-only.
forked from tilemill-project/tilemill
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.js
executable file
·49 lines (40 loc) · 1.42 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/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 {
require('./lib/fsutils').cprSync(from,to);
return cb();
} catch (err) {
return cb(err);
}
}
}
}
}
// Default --config flag to user's home .tilemill.json config file.
// @TODO find a more elegant way to set a default for this value
// upstream in bones.
var path = require('path');
var config = path.join(process.env.HOME, '.tilemill/config.json');
if (path.existsSync(config)) {
var argv = require('optimist').argv;
argv.config = argv.config || config;
}
require('tilelive-mapnik').registerProtocols(require('tilelive'));
require('mbtiles').registerProtocols(require('tilelive'));
require('bones').load(__dirname);
!module.parent && require('bones').start();