mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Расширение логики HashedDir Store
This commit is contained in:
parent
da739b3eb6
commit
c700ec2791
2 changed files with 12 additions and 3 deletions
|
@ -71,7 +71,12 @@ public static Path getLauncherDir(String projectname) throws IOException {
|
|||
@LauncherAPI
|
||||
public static Path getStoreDir(String projectname) throws IOException
|
||||
{
|
||||
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
|
||||
public static Path getProjectStoreDir(String projectname) throws IOException
|
||||
|
|
|
@ -24,8 +24,10 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
|
|||
{
|
||||
try(HInput input = new HInput(IOHelper.newInput(file)))
|
||||
{
|
||||
String dirName = input.readString(128);
|
||||
String fullPath = input.readString(1024);
|
||||
HashedDir dir = new HashedDir(input);
|
||||
settings.lastHDirs.put(file.getFileName().toString(), dir);
|
||||
settings.lastHDirs.put(dirName, dir);
|
||||
}
|
||||
return super.visitFile(file, attrs);
|
||||
}
|
||||
|
@ -68,9 +70,11 @@ public void saveHDirStore(Path storeProjectPath) throws IOException
|
|||
Files.createDirectories(storeProjectPath);
|
||||
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)))
|
||||
{
|
||||
output.writeString(e.getKey(), 128);
|
||||
output.writeString("", 1024);
|
||||
e.getValue().write(output);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue