Skip to content

Commit 2856600

Browse files
committed
Windows: Use Shell32 utility to determine known paths
1 parent cbf3cdc commit 2856600

File tree

6 files changed

+6
-274
lines changed

6 files changed

+6
-274
lines changed

app/test/processing/app/windows/RegQueryParserTest.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

arduino-core/src/cc/arduino/os/windows/FolderFinder.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

arduino-core/src/cc/arduino/os/windows/FolderFinderInWindowsEnvVar.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

arduino-core/src/cc/arduino/os/windows/FolderFinderInWindowsRegistry.java

Lines changed: 0 additions & 58 deletions
This file was deleted.

arduino-core/src/processing/app/windows/Platform.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
package processing.app.windows;
2424

25-
import cc.arduino.os.windows.FolderFinderInWindowsEnvVar;
26-
import cc.arduino.os.windows.FolderFinderInWindowsRegistry;
25+
import cc.arduino.os.windows.Win32KnownFolders;
2726
import processing.app.legacy.PApplet;
2827
import processing.app.legacy.PConstants;
2928

@@ -50,28 +49,18 @@ public void init() throws Exception {
5049
}
5150

5251
private void recoverSettingsFolderPath() throws Exception {
53-
FolderFinderInWindowsRegistry findInUserShellFolders = new FolderFinderInWindowsRegistry(null, "Documents", "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", "Local AppData");
54-
FolderFinderInWindowsRegistry findInShellFolders = new FolderFinderInWindowsRegistry(findInUserShellFolders, "Documents", "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Local AppData");
55-
56-
Path path = findInShellFolders.find();
57-
this.settingsFolder = path.resolve("Arduino15").toFile();
52+
Path path = Win32KnownFolders.getLocalAppDataFolder().toPath();
53+
settingsFolder = path.resolve("Arduino15").toFile();
5854
}
5955

6056
private Path recoverOldSettingsFolderPath() throws Exception {
61-
FolderFinderInWindowsRegistry findInUserShellFolders = new FolderFinderInWindowsRegistry(null, "Documents", "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", "AppData");
62-
FolderFinderInWindowsRegistry findInShellFolders = new FolderFinderInWindowsRegistry(findInUserShellFolders, "Documents", "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "AppData");
63-
64-
Path path = findInShellFolders.find();
57+
Path path = Win32KnownFolders.getRoamingAppDataFolder().toPath();
6558
return path.resolve("Arduino15");
6659
}
6760

6861
private void recoverDefaultSketchbookFolder() throws Exception {
69-
FolderFinderInWindowsEnvVar findInUserProfile = new FolderFinderInWindowsEnvVar(null, "Documents", "USERPROFILE");
70-
FolderFinderInWindowsRegistry findInUserShellFolders = new FolderFinderInWindowsRegistry(findInUserProfile, "Documents", "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", "Personal");
71-
FolderFinderInWindowsRegistry findInShellFolders = new FolderFinderInWindowsRegistry(findInUserShellFolders, "Documents", "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Personal");
72-
73-
Path path = findInShellFolders.find();
74-
this.defaultSketchbookFolder = path.resolve("Arduino").toFile();
62+
Path path = Win32KnownFolders.getDocumentsFolder().toPath();
63+
defaultSketchbookFolder = path.resolve("Arduino").toFile();
7564
}
7665

7766
/**

arduino-core/src/processing/app/windows/RegQueryParser.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)