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