mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-06-28 20:18:10 +03:00
[FIX] Probably fix access profileMap with multiple threads
This commit is contained in:
parent
b149686abd
commit
101d8c7275
1 changed files with 3 additions and 2 deletions
|
@ -23,6 +23,7 @@
|
|||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class LocalProfilesProvider extends ProfilesProvider implements Reconfigurable {
|
||||
|
@ -196,7 +197,7 @@ private void readCache(Path file) throws IOException {
|
|||
|
||||
public void readProfilesDir() throws IOException {
|
||||
Path profilesDirPath = Path.of(profilesDir);
|
||||
Map<UUID, LocalProfile> newProfiles = new HashMap<>();
|
||||
Map<UUID, LocalProfile> newProfiles = new ConcurrentHashMap<>();
|
||||
IOHelper.walk(profilesDirPath, new ProfilesFileVisitor(newProfiles), false);
|
||||
profilesMap = newProfiles;
|
||||
}
|
||||
|
@ -218,7 +219,7 @@ public void readUpdatesDir() throws IOException {
|
|||
|
||||
public void sync(Collection<String> dirs) throws IOException {
|
||||
logger.info("Syncing updates dir");
|
||||
Map<String, HashedDir> newUpdatesDirMap = new HashMap<>(16);
|
||||
Map<String, HashedDir> newUpdatesDirMap = new ConcurrentHashMap<>(16);
|
||||
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(Path.of(updatesDir))) {
|
||||
for (final Path updateDir : dirStream) {
|
||||
if (Files.isHidden(updateDir))
|
||||
|
|
Loading…
Reference in a new issue