File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
arduino-core/src/cc/arduino/os/windows Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 3838import java .nio .file .Paths ;
3939
4040import com .sun .jna .platform .win32 .Shell32Util ;
41+ import com .sun .jna .platform .win32 .ShlObj ;
4142
4243import processing .app .PreferencesData ;
4344
4445public class Win32KnownFolders {
4546
4647 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 ));
4854 }
4955
5056 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 ));
5263 }
5364
5465 public static File getDocumentsFolder () {
66+ try {
5567 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 ));
5672 }
5773
5874 public static File getLocalCacheFolder () throws FileNotFoundException {
You can’t perform that action at this time.
0 commit comments