[FIX] Расширение логики HashedDir Store

This commit is contained in:
Gravit 2019-04-13 23:59:41 +07:00
parent da739b3eb6
commit c700ec2791
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 12 additions and 3 deletions

View file

@ -71,7 +71,12 @@ public static Path getLauncherDir(String projectname) throws IOException {
@LauncherAPI @LauncherAPI
public static Path getStoreDir(String projectname) throws IOException public static Path getStoreDir(String projectname) throws IOException
{ {
return getAppDataDir().resolve("store"); if(JVMHelper.OS_TYPE == JVMHelper.OS.LINUX)
return getAppDataDir().resolve("store");
else if(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE)
return getAppDataDir().resolve("GravitLauncherStore");
else
return getAppDataDir().resolve("minecraftStore");
} }
@LauncherAPI @LauncherAPI
public static Path getProjectStoreDir(String projectname) throws IOException public static Path getProjectStoreDir(String projectname) throws IOException

View file

@ -24,8 +24,10 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
{ {
try(HInput input = new HInput(IOHelper.newInput(file))) try(HInput input = new HInput(IOHelper.newInput(file)))
{ {
String dirName = input.readString(128);
String fullPath = input.readString(1024);
HashedDir dir = new HashedDir(input); HashedDir dir = new HashedDir(input);
settings.lastHDirs.put(file.getFileName().toString(), dir); settings.lastHDirs.put(dirName, dir);
} }
return super.visitFile(file, attrs); return super.visitFile(file, attrs);
} }
@ -68,9 +70,11 @@ public void saveHDirStore(Path storeProjectPath) throws IOException
Files.createDirectories(storeProjectPath); Files.createDirectories(storeProjectPath);
for(Map.Entry<String, HashedDir> e : settings.lastHDirs.entrySet()) for(Map.Entry<String, HashedDir> e : settings.lastHDirs.entrySet())
{ {
Path file = Files.createFile(storeProjectPath.resolve(e.getKey())); Path file = Files.createFile(storeProjectPath.resolve(e.getKey().concat(".bin")));
try(HOutput output = new HOutput(IOHelper.newOutput(file))) try(HOutput output = new HOutput(IOHelper.newOutput(file)))
{ {
output.writeString(e.getKey(), 128);
output.writeString("", 1024);
e.getValue().write(output); e.getValue().write(output);
} }
} }