kopia lustrzana https://github.com/c9/core
fix windows path handling issues
rodzic
91f98d3aee
commit
30129604cc
|
@ -109,7 +109,7 @@
|
||||||
"c9.ide.recentfiles": "#7c099abf40",
|
"c9.ide.recentfiles": "#7c099abf40",
|
||||||
"c9.ide.remote": "#301d2ab519",
|
"c9.ide.remote": "#301d2ab519",
|
||||||
"c9.ide.processlist": "#2b12cd1bdd",
|
"c9.ide.processlist": "#2b12cd1bdd",
|
||||||
"c9.ide.run": "#d661a7b847",
|
"c9.ide.run": "#20a43e01e4",
|
||||||
"c9.ide.run.build": "#0598fff697",
|
"c9.ide.run.build": "#0598fff697",
|
||||||
"c9.ide.run.debug.xdebug": "#054367574c",
|
"c9.ide.run.debug.xdebug": "#054367574c",
|
||||||
"c9.ide.save": "#25a63f31e2",
|
"c9.ide.save": "#25a63f31e2",
|
||||||
|
|
|
@ -122,9 +122,9 @@ define(function(require, module, exports) {
|
||||||
emit("quit");
|
emit("quit");
|
||||||
}
|
}
|
||||||
|
|
||||||
function toExternalPath(path) {
|
function toExternalPath(path, sep) {
|
||||||
if (plugin.platform == "win32")
|
if (plugin.platform == "win32")
|
||||||
path = path.replace(/^[/]+/, "").replace(/[/]+/g, "\\");
|
path = path.replace(/^[/]+/, "").replace(/[/]+/g, sep || "\\");
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,20 +208,21 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
var reHome, reWorkspace, homeSub;
|
var reHome, reWorkspace, homeSub;
|
||||||
plugin.$initPaths = function(home, workspaceDir) {
|
plugin.$initPaths = function(home, workspaceDir) {
|
||||||
reHome = new RegExp("^" + plugin.escapeRegExp(home) + "(/|/?$)");
|
var pre = c9.platform == "win32" ? "/?" : "";
|
||||||
|
reHome = new RegExp("^" + pre + plugin.escapeRegExp(home) + "(/|/?$)");
|
||||||
var wd = workspaceDir.replace(/\/?$/, "");
|
var wd = workspaceDir.replace(/\/?$/, "");
|
||||||
reWorkspace = new RegExp("^" + plugin.escapeRegExp(wd) + "(/|/?$)");
|
reWorkspace = new RegExp("^" + pre + plugin.escapeRegExp(wd) + "(/|/?$)");
|
||||||
homeSub = "~/";
|
homeSub = "~/";
|
||||||
if (home == workspaceDir) {
|
if (home == workspaceDir) {
|
||||||
reHome = new RegExp("^(" + plugin.escapeRegExp(home) + "|~)(/|/?$)");
|
reHome = new RegExp("^(" + pre + plugin.escapeRegExp(home) + "|~)(/|/?$)");
|
||||||
homeSub = "/";
|
homeSub = "/";
|
||||||
reWorkspace = null;
|
reWorkspace = null;
|
||||||
} else if (reHome.test(workspaceDir)) {
|
} else if (reHome.test(workspaceDir)) {
|
||||||
reWorkspace = new RegExp("^" +
|
reWorkspace = new RegExp("^" + pre +
|
||||||
plugin.escapeRegExp(workspaceDir.replace(reHome, "~/")) + "(/|/?$)"
|
plugin.escapeRegExp(workspaceDir.replace(reHome, "~/")) + "(/|/?$)"
|
||||||
);
|
);
|
||||||
} else if (reWorkspace.test(home)) {
|
} else if (reWorkspace.test(home)) {
|
||||||
reHome = new RegExp("^(" + plugin.escapeRegExp(home) + "|~)(/|/?$)");
|
reHome = new RegExp("^(" + pre + plugin.escapeRegExp(home) + "|~)(/|/?$)");
|
||||||
homeSub = home.replace(reWorkspace, "/").replace(/\/?$/, "/");
|
homeSub = home.replace(reWorkspace, "/").replace(/\/?$/, "/");
|
||||||
reWorkspace = null;
|
reWorkspace = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,8 +205,7 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure home dir is marked correctly
|
// Make sure home dir is marked correctly
|
||||||
path = path.replace(reHome, "~");
|
path = util.normalizePath(path);
|
||||||
if (path[0] != "/") path = "/" + path;
|
|
||||||
|
|
||||||
fs.stat(path, function(err, stat) {
|
fs.stat(path, function(err, stat) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -149,16 +149,16 @@ function plugin(options, imports, register) {
|
||||||
return next();
|
return next();
|
||||||
|
|
||||||
res.writeHead(200, {"Content-Type": "application/javascript"});
|
res.writeHead(200, {"Content-Type": "application/javascript"});
|
||||||
res.end("define(function(require, exports, module) { return '"
|
res.end("define(function(require, exports, module) { return "
|
||||||
+ options.workspaceDir + "'; });");
|
+ JSON.stringify(options.workspaceDir.replace(/\\/g, "/")) + "; });");
|
||||||
});
|
});
|
||||||
api.get("/vfs-home", function(req, res, next) {
|
api.get("/vfs-home", function(req, res, next) {
|
||||||
if (!options.options.testing)
|
if (!options.options.testing)
|
||||||
return next();
|
return next();
|
||||||
|
|
||||||
res.writeHead(200, {"Content-Type": "application/javascript"});
|
res.writeHead(200, {"Content-Type": "application/javascript"});
|
||||||
res.end("define(function(require, exports, module) { return '"
|
res.end("define(function(require, exports, module) { return "
|
||||||
+ process.env.HOME + "'; });");
|
+ JSON.stringify(process.env.HOME.replace(/\\/g, "/")) + "; });");
|
||||||
});
|
});
|
||||||
|
|
||||||
api.get("/update", function(req, res, next) {
|
api.get("/update", function(req, res, next) {
|
||||||
|
|
Ładowanie…
Reference in New Issue