@Override public Path getSettingsPath() { Path path = Paths.get( Shell32Util.getFolderPath(ShlObj.CSIDL_MYDOCUMENTS) ).resolve("ArduinoData"); if (Files.exists(path)) { return path; } path = Paths.get( Shell32Util.getFolderPath(ShlObj.CSIDL_LOCAL_APPDATA) ).resolve("Arduino15"); if ( Files.exists(path) ) { return path; } path = Paths.get(Shell32Util.getFolderPath(ShlObj.CSIDL_APPDATA) ).resolve("Arduino15"); if ( Files.exists(path) ) { return path; } return null; }
protected int convertFolderId(FolderId folderId) { switch (folderId) { case APPDATA: return ShlObj.CSIDL_APPDATA; case LOCAL_APPDATA: return ShlObj.CSIDL_LOCAL_APPDATA; case COMMON_APPDATA: return ShlObj.CSIDL_COMMON_APPDATA; default: throw new AppDirsException( "Unknown folder ID " + folderId + " was specified."); } }
@Override public Path getSketchPath() { return Paths.get( Shell32Util.getFolderPath(ShlObj.CSIDL_MYDOCUMENTS) ).resolve("Arduino"); }
@Nonnull @Override public File getExternalPlatformDirectory(@Nonnull File defaultPath) { return new File(Shell32Util.getFolderPath(ShlObj.CSIDL_APPDATA), "Consulo Platform"); }
@Nonnull @Override protected String getDocumentsDirNoPrefix() { return Shell32Util.getFolderPath(ShlObj.CSIDL_PERSONAL); }
@Nonnull @Override protected String getLocalSettingsDirNoPrefix() { // will return path like C:\Users\{user.name}\AppData\Local return Shell32Util.getFolderPath(ShlObj.CSIDL_LOCAL_APPDATA); }
@Nonnull @Override protected String getRoamingSettingsDirNoPrefix() { // will return path like C:\Users\{user.name}\AppData\Roaming return Shell32Util.getFolderPath(ShlObj.CSIDL_APPDATA); }
/************************************************************************* * Reads the current location of the app data folder from the registry. * * @return a path to the folder. ************************************************************************/ private String getAppFolder() { return Shell32Util.getFolderPath(ShlObj.CSIDL_APPDATA); }