Hi there,
I searched the whole morning today, but either I am to stupid to find the correct search words or there is no solution for this. 🙄
I want to write/read a text file on iOS in my MV Game.
I found a code snippet wich works on the Mac
But I get an error if I want to use it on my iPhone.
It says
ReferenceError
Can't find variable:require
Can someone help me with this?
Thank you and best regards
Andreas
I searched the whole morning today, but either I am to stupid to find the correct search words or there is no solution for this. 🙄
I want to write/read a text file on iOS in my MV Game.
I found a code snippet wich works on the Mac
Code:
var path = window.location.pathname.replace(/(\/www|)\/[^\/]*$/, '/data/');
if (path.match(/^\/([A-Z]\:)/)) {
path = path.slice(1);
}
path = decodeURIComponent(path) + "save.txt";
var fs = require('fs');
fs.writeFile(path, "Game Complete", function(err) {
if(err) {
return console.log(err);
}
});
But I get an error if I want to use it on my iPhone.
It says
ReferenceError
Can't find variable:require
Can someone help me with this?
Thank you and best regards
Andreas