Skip to content

Commit

Permalink
プロファイル保存時にlocalStorageに仮想ファイルリストを出力
Browse files Browse the repository at this point in the history
  • Loading branch information
yahiro07 committed Feb 7, 2024
1 parent 8d5af22 commit 563ed3f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions software/src/memoryFileSystem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface IMemoryFileSystem {
setMemoryStorageRevision(rev: number): void;
initialize(): void;
terminate(): void;
forceSavedToLocalStorage(): void;
isExist(path: string): boolean;
readFile(path: string): string;
writeFile(path: string, content: string): void;
Expand Down Expand Up @@ -72,6 +73,14 @@ function createMemoryFileSystem(): IMemoryFileSystem {
const text = JSON.stringify(persistData);
localStorage.setItem(localStorageKey, text);
},
forceSavedToLocalStorage() {
const persistData: IMemoryFileSystemPersistData = {
fileEntities,
memoryStorageRevision,
};
const text = JSON.stringify(persistData);
localStorage.setItem(localStorageKey, text);
},
isExist(path) {
return !!findFileEntityByPath(path);
},
Expand Down
2 changes: 1 addition & 1 deletion software/src/shell/base/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const processEnv = (import.meta as any).env as IProcessEnv;
// console.log({ processEnv });

export const appConfig = {
applicationVersion: 'v240201',
applicationVersion: 'v240207',
isDevelopment: processEnv.DEV,
// isDevelopment: location.host === 'localhost',
// applicationVersion: app.getVersion(),
Expand Down
2 changes: 2 additions & 0 deletions software/src/shell/modules/profile/profileManagerCore.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { memoryFileSystem } from '~/memoryFileSystem';
import {
fileExtensions,
IFileReadHandle,
Expand Down Expand Up @@ -125,6 +126,7 @@ export const profileManagerCore = {
profileData,
profileEntry.profileName,
);
memoryFileSystem.forceSavedToLocalStorage();
},
async loadExternalProfileFile(
fileHandle: IFileReadHandle,
Expand Down

0 comments on commit 563ed3f

Please sign in to comment.