mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 07:21:43 +00:00
fix
This commit is contained in:
parent
1dd049f015
commit
d3c4292b6f
18
app.js
18
app.js
|
@ -144,7 +144,7 @@ function require(FN) {
|
|||
T = objStream.readText();
|
||||
objStream.close();
|
||||
} catch (e) {
|
||||
console.error("LOAD ERROR! " + e.number + ", " + e.description + ", FN=" + FN, 1);
|
||||
console.error("LOAD ERROR! ", e.number, ", ", e.description, ", FN=", FN);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ function require(FN) {
|
|||
try {
|
||||
cache[FN] = eval(T);
|
||||
} catch (e) {
|
||||
console.error("PARSE ERROR! " + e.number + ", " + e.description + ", FN=" + FN, 1);
|
||||
console.error("PARSE ERROR! ", e.number, ", ", e.description, ", FN=", FN);
|
||||
}
|
||||
|
||||
// check type of callback return
|
||||
|
@ -189,10 +189,10 @@ function init_console() {
|
|||
exit(exitstatus);
|
||||
}
|
||||
} else {
|
||||
console.error("Error, missing main entry point in " + name + ".js", 1);
|
||||
console.error("Error, missing main entry point in ", name, ".js");
|
||||
}
|
||||
} else {
|
||||
console.error("Error, cannot find " + name + ".js", 1);
|
||||
console.error("Error, cannot find ", name, ".js");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -212,17 +212,17 @@ function init_window(name, args, w, h) {
|
|||
// "load app";
|
||||
if (app) {
|
||||
if (app.main) {
|
||||
var exitstatus = app.main.call(app, args);
|
||||
if (exitstatus > 0) {
|
||||
var exitStatus = app.main.call(app, args);
|
||||
if (exitStatus > 0) {
|
||||
console.error("error");
|
||||
exit(exitstatus);
|
||||
exit(exitStatus);
|
||||
}
|
||||
} else {
|
||||
console.error("Error, missing main entry point in " + name + ".js");
|
||||
console.error("Error, missing main entry point in ", name, ".js");
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
console.error("Error, cannot find " + name + ".js");
|
||||
console.error("Error, cannot find ", name, ".js");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
94
lib/file.js
94
lib/file.js
|
@ -162,61 +162,85 @@ var FileObject = function() {
|
|||
};
|
||||
|
||||
this.remove = function() {
|
||||
if (this.isFile) {
|
||||
return this.interface.DeleteFile(this.filename);
|
||||
} else {
|
||||
return this.interface.DeleteFolder(this.filename);
|
||||
try {
|
||||
if (this.isFile) {
|
||||
return this.interface.DeleteFile(this.filename);
|
||||
} else {
|
||||
return this.interface.DeleteFolder(this.filename);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("FileObject.remove() -> ", e.message);
|
||||
}
|
||||
};
|
||||
|
||||
this.moveTo = function(dst) {
|
||||
if (this.isFile) {
|
||||
return this.interface.MoveFile(this.filename, dst);
|
||||
} else {
|
||||
return this.interface.MoveFolder(this.filename, dst);
|
||||
try {
|
||||
if (this.isFile) {
|
||||
return this.interface.MoveFile(this.filename, dst);
|
||||
} else {
|
||||
return this.interface.MoveFolder(this.filename, dst);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("FileObject.moveTo() -> ", e.message);
|
||||
}
|
||||
};
|
||||
|
||||
this.read = function() {
|
||||
if (this.isFile) {
|
||||
return readFile(this.filename, this.charset);
|
||||
try {
|
||||
if (this.isFile) {
|
||||
return readFile(this.filename, this.charset);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("FileObject.read() -> ", e.message);
|
||||
}
|
||||
};
|
||||
|
||||
this.write = function(content) {
|
||||
if (this.isFile) {
|
||||
return writeFile(this.filename, content, this.charset);
|
||||
try {
|
||||
if (this.isFile) {
|
||||
return writeFile(this.filename, content, this.charset);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("FileObject.write() -> ", e.message);
|
||||
}
|
||||
};
|
||||
|
||||
this.chown = function(username) {
|
||||
if (this.isFile) {
|
||||
//require("lib/shell").run(["cacls", this.filename, "/G", user + ":F"]);
|
||||
require("lib/shell").run([
|
||||
"icacls",
|
||||
"/C",
|
||||
"/q",
|
||||
this.filename,
|
||||
"/grant",
|
||||
username + ":(F)"
|
||||
]);
|
||||
} else if (this.isDirectory) {
|
||||
//require("lib/shell").run(["cacls", this.filename, "/G", user + ":F"]);
|
||||
require("lib/shell").run([
|
||||
"icacls",
|
||||
"/C",
|
||||
"/t",
|
||||
"/q",
|
||||
this.filename,
|
||||
"/grant",
|
||||
username + ":(F)"
|
||||
]);
|
||||
try {
|
||||
if (this.isFile) {
|
||||
//require("lib/shell").run(["cacls", this.filename, "/G", user + ":F"]);
|
||||
require("lib/shell").run([
|
||||
"icacls",
|
||||
"/C",
|
||||
"/q",
|
||||
this.filename,
|
||||
"/grant",
|
||||
username + ":(F)"
|
||||
]);
|
||||
} else if (this.isDirectory) {
|
||||
//require("lib/shell").run(["cacls", this.filename, "/G", user + ":F"]);
|
||||
require("lib/shell").run([
|
||||
"icacls",
|
||||
"/C",
|
||||
"/t",
|
||||
"/q",
|
||||
this.filename,
|
||||
"/grant",
|
||||
username + ":(F)"
|
||||
]);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("FileObject.chown() -> ", e.message);
|
||||
}
|
||||
};
|
||||
|
||||
this.mkdir = function() {
|
||||
if (this.isDirectory) {
|
||||
return this.interface.CreateFolder(this.filename);
|
||||
try {
|
||||
if (this.isDirectory) {
|
||||
return this.interface.CreateFolder(this.filename);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("FileObject.mkdir() -> ", e.message);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@ global.console._echo = function(args, type) {
|
|||
case "info":
|
||||
heading = "Information";
|
||||
icon = "info";
|
||||
break;
|
||||
|
||||
default:
|
||||
heading = "Success";
|
||||
icon = "success";
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue
Block a user