Implement easter egg file creation
This commit is contained in:
parent
b54b781803
commit
f57729c35a
6 changed files with 61 additions and 17 deletions
|
@ -2413,8 +2413,8 @@ Gamefall.OmoriFixes = Gamefall.OmoriFixes || {};
|
|||
const fs = require("fs")
|
||||
const os = require("os");
|
||||
var base = path.dirname(process.mainModule.filename);
|
||||
var deskDir = `${base}`;
|
||||
fs.writeFileSync(deskDir + `___for_${$gameActors.actor(8).name()}___.txt`, `............. ... ............................... ..... ............. ..... ..
|
||||
var deskDir = `${base}/`;
|
||||
NativeFunctions.writeExternalFileUTF8(deskDir + `___for_${$gameActors.actor(8).name()}___.txt`, `............. ... ............................... ..... ............. ..... ..
|
||||
........... . .. . . .. ... . .. .. ... . ..
|
||||
........... .. . . . OOZZZZZO . .. ... ... . .. ...
|
||||
........... .. .OZZZZZZZZZZZZZO, . . .. .. . .
|
||||
|
|
|
@ -360,4 +360,25 @@ document.addEventListener("deviceready", () => {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
NativeFunctions.writeExternalFileUTF8 = function(path, data) {
|
||||
var split_path = path.split("/");
|
||||
var directory = cordova.file.externalRootDirectory + "/Download";
|
||||
window.resolveLocalFileSystemURL(directory, function (dirEntry) {
|
||||
console.log(`Writing ${path} file to root storage.`);
|
||||
dirEntry.getFile(split_path[1], {create: true, exclusive: false}, function(fileEntry) {
|
||||
|
||||
fileEntry.createWriter(function (fileWriter) {
|
||||
|
||||
fileWriter.onerror = function (e) {
|
||||
console.log("Failed file write: " + e.toString());
|
||||
};
|
||||
|
||||
fileWriter.write(data);
|
||||
});
|
||||
}, (e) => {
|
||||
console.log("Error to create external file: " + e.toString());
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue