22
22
23
23
package processing .app .windows ;
24
24
25
- import cc .arduino .os .windows .FolderFinderInWindowsEnvVar ;
26
- import cc .arduino .os .windows .FolderFinderInWindowsRegistry ;
25
+ import cc .arduino .os .windows .Win32KnownFolders ;
27
26
import processing .app .legacy .PApplet ;
28
27
import processing .app .legacy .PConstants ;
29
28
@@ -50,28 +49,18 @@ public void init() throws Exception {
50
49
}
51
50
52
51
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 ();
58
54
}
59
55
60
56
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 ();
65
58
return path .resolve ("Arduino15" );
66
59
}
67
60
68
61
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 ();
75
64
}
76
65
77
66
/**
0 commit comments