mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Attempt #1 on preserving savegame files
This commit is contained in:
@@ -58,11 +58,6 @@ export class StorageImplBrowser extends StorageInterface {
|
||||
});
|
||||
}
|
||||
|
||||
writeFileSyncIfSupported(filename, contents) {
|
||||
window.localStorage.setItem(filename, contents);
|
||||
return true;
|
||||
}
|
||||
|
||||
readFileAsync(filename) {
|
||||
if (this.currentBusyFilename === filename) {
|
||||
logger.warn("Attempt to read", filename, "while write progress on it is ongoing!");
|
||||
|
||||
@@ -94,12 +94,6 @@ export class StorageImplBrowserIndexedDB extends StorageInterface {
|
||||
});
|
||||
}
|
||||
|
||||
writeFileSyncIfSupported(filename, contents) {
|
||||
// Not supported
|
||||
this.writeFileAsync(filename, contents);
|
||||
return true;
|
||||
}
|
||||
|
||||
readFileAsync(filename) {
|
||||
if (!this.database) {
|
||||
return Promise.reject("Storage not ready");
|
||||
|
||||
@@ -46,14 +46,6 @@ export class StorageImplElectron extends StorageInterface {
|
||||
});
|
||||
}
|
||||
|
||||
writeFileSyncIfSupported(filename, contents) {
|
||||
return getIPCRenderer().sendSync("fs-sync-job", {
|
||||
type: "write",
|
||||
filename,
|
||||
contents,
|
||||
});
|
||||
}
|
||||
|
||||
readFileAsync(filename) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// ipcMain
|
||||
|
||||
@@ -30,16 +30,6 @@ export class StorageInterface {
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to write a file synchronously, used in unload handler
|
||||
* @param {string} filename
|
||||
* @param {string} contents
|
||||
*/
|
||||
writeFileSyncIfSupported(filename, contents) {
|
||||
abstract;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a string asynchronously. Returns Promise<FILE_NOT_FOUND> if file was not found.
|
||||
* @param {string} filename
|
||||
|
||||
Reference in New Issue
Block a user