kopia lustrzana https://github.com/c9/core
Merge pull request +15696 from c9/pull/core/455
rewriting gdbshim when updatedpull/333/merge
commit
f924015491
|
@ -34,6 +34,9 @@ define(function(require, exports, module) {
|
|||
var emit = plugin.getEmitter();
|
||||
emit.setMaxListeners(1000);
|
||||
|
||||
// increment when shim is updated to force rewrite
|
||||
var SHIM_VERSION = 1;
|
||||
|
||||
var TYPE = "gdb";
|
||||
|
||||
var attached = false;
|
||||
|
@ -63,16 +66,24 @@ define(function(require, exports, module) {
|
|||
debug.registerDebugger(TYPE, plugin);
|
||||
|
||||
// writeFile root is workspace directory, unless given ~
|
||||
var shimPath = "~/.c9/bin/c9gdbshim.js";
|
||||
var shimVersion = "~/.c9/bin/.c9gdbshim" + SHIM_VERSION;
|
||||
var shim = require("text!./shim.js");
|
||||
fs.exists(shimPath, function(exists) {
|
||||
if (exists) return; // TODO use localfs extend when it is ready
|
||||
fs.writeFile(shimPath, shim, "utf8", function(err) {
|
||||
fs.exists(shimVersion, function(exists) {
|
||||
if (exists)
|
||||
return;
|
||||
|
||||
fs.writeFile("~/.c9/bin/c9gdbshim.js", shim, "utf8", function(err) {
|
||||
if (err) {
|
||||
// unregister the debugger on error
|
||||
debug.unregisterDebugger(TYPE, plugin);
|
||||
return console.log("Error writing gdb shim: " + err);
|
||||
}
|
||||
|
||||
// remember we wrote current version
|
||||
fs.writeFile(shimVersion, "", function(err) {
|
||||
if (err)
|
||||
return console.log("Error writing shim version: " + err);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue