+/* Cycript - Optimizing JavaScript Compiler/Runtime
+ * Copyright (C) 2009-2015 Jay Freeman (saurik)
+*/
+
+/* GNU Affero General Public License, Version 3 {{{ */
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
var process = {
env: {},
};
$cy_set(Error.prototype, {
toCYON: function() {
- return `new ${this.constructor.name}(${this.message.toCYON()})`;
+ let stack = this.stack.split('\n');
+ if (stack.slice(-1)[0] == "global code")
+ stack = stack.slice(0, -1);
+ for (let i = 0; i != stack.length; ++i)
+ stack[i] = '\n ' + stack[i];
+ return `new ${this.constructor.name}(${this.message.toCYON()}) /*${stack.join('')} */`;
},
});
if (slash == -1)
return null;
- return path.substr(0, slash);
+ path = path.substr(0, slash);
+
+ GetLibraryPath = function() {
+ return path;
+ };
+
+ return GetLibraryPath();
} finally {
dlclose(handle);
}