fix: Saving files in web version not working correctly
This commit is contained in:
parent
9c1a673047
commit
42c1f5601a
@ -123,7 +123,13 @@ namespace hex::fs {
|
|||||||
// Call callback that will write the file
|
// Call callback that will write the file
|
||||||
Module._fileBrowserCallback(stringToNewUTF8("/savedFiles/" + filename));
|
Module._fileBrowserCallback(stringToNewUTF8("/savedFiles/" + filename));
|
||||||
|
|
||||||
let data = FS.readFile("/savedFiles/" + filename);
|
let data;
|
||||||
|
try {
|
||||||
|
data = FS.readFile("/savedFiles/" + filename);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const reader = Object.assign(new FileReader(), {
|
const reader = Object.assign(new FileReader(), {
|
||||||
onload: () => {
|
onload: () => {
|
||||||
@ -191,6 +197,7 @@ namespace hex::fs {
|
|||||||
else if (!validExtensions.empty())
|
else if (!validExtensions.empty())
|
||||||
path = "file." + validExtensions[0].spec;
|
path = "file." + validExtensions[0].spec;
|
||||||
|
|
||||||
|
std::fs::create_directory("/savedFiles");
|
||||||
callJs_saveFile(path.filename().string().c_str());
|
callJs_saveFile(path.filename().string().c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user