File tree 1 file changed +18
-2
lines changed
arduino-core/src/cc/arduino/os/windows 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 38
38
import java .nio .file .Paths ;
39
39
40
40
import com .sun .jna .platform .win32 .Shell32Util ;
41
+ import com .sun .jna .platform .win32 .ShlObj ;
41
42
42
43
import processing .app .PreferencesData ;
43
44
44
45
public class Win32KnownFolders {
45
46
46
47
public static File getLocalAppDataFolder () {
47
- return new File (Shell32Util .getKnownFolderPath (FOLDERID_LocalAppData ));
48
+ try {
49
+ return new File (Shell32Util .getKnownFolderPath (FOLDERID_LocalAppData ));
50
+ } catch (Throwable t ) {
51
+ // Ignore error if API call is not available
52
+ }
53
+ return new File (Shell32Util .getFolderPath (ShlObj .CSIDL_LOCAL_APPDATA ));
48
54
}
49
55
50
56
public static File getRoamingAppDataFolder () {
51
- return new File (Shell32Util .getKnownFolderPath (FOLDERID_RoamingAppData ));
57
+ try {
58
+ return new File (Shell32Util .getKnownFolderPath (FOLDERID_RoamingAppData ));
59
+ } catch (Throwable t ) {
60
+ // Ignore error if API call is not available
61
+ }
62
+ return new File (Shell32Util .getFolderPath (ShlObj .CSIDL_APPDATA ));
52
63
}
53
64
54
65
public static File getDocumentsFolder () {
66
+ try {
55
67
return new File (Shell32Util .getKnownFolderPath (FOLDERID_Documents ));
68
+ } catch (Throwable t ) {
69
+ // Ignore error if API call is not available
70
+ }
71
+ return new File (Shell32Util .getFolderPath (ShlObj .CSIDL_MYDOCUMENTS ));
56
72
}
57
73
58
74
public static File getLocalCacheFolder () throws FileNotFoundException {
You can’t perform that action at this time.
0 commit comments