mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX][EXPERIMENTAL] Исправление ошибки сохранения HashedStoreEntry
This commit is contained in:
parent
c6389c697b
commit
69aef41e5d
2 changed files with 7 additions and 4 deletions
|
@ -47,6 +47,8 @@ public static class HashedStoreEntry {
|
|||
public String name;
|
||||
@LauncherAPI
|
||||
public String fullPath;
|
||||
@LauncherAPI
|
||||
public transient boolean needSave = false;
|
||||
|
||||
public HashedStoreEntry(HashedDir hdir, String name, String fullPath) {
|
||||
this.hdir = hdir;
|
||||
|
@ -61,9 +63,9 @@ public HashedStoreEntry(HashedDir hdir, String name, String fullPath) {
|
|||
@LauncherAPI
|
||||
public void putHDir(String name, Path path, HashedDir dir) {
|
||||
String fullPath = path.toAbsolutePath().toString();
|
||||
for (HashedStoreEntry e : lastHDirs) {
|
||||
if (e.fullPath.equals(fullPath) && e.name.equals(name)) return;
|
||||
}
|
||||
lastHDirs.add(new HashedStoreEntry(dir, name, fullPath));
|
||||
lastHDirs.removeIf((e) -> e.fullPath.equals(fullPath) && e.name.equals(name));
|
||||
HashedStoreEntry e = new HashedStoreEntry(dir, name, fullPath);
|
||||
e.needSave = true;
|
||||
lastHDirs.add(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ public void loadHDirStore(Path storePath) throws IOException {
|
|||
public void saveHDirStore(Path storeProjectPath) throws IOException {
|
||||
Files.createDirectories(storeProjectPath);
|
||||
for (NewLauncherSettings.HashedStoreEntry e : settings.lastHDirs) {
|
||||
if(!e.needSave) continue;
|
||||
Path file = storeProjectPath.resolve(e.name.concat(".bin"));
|
||||
if (!Files.exists(file)) Files.createFile(file);
|
||||
try (HOutput output = new HOutput(IOHelper.newOutput(file))) {
|
||||
|
|
Loading…
Reference in a new issue