diff --git a/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java b/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java index 2bef2a243401934e0f835f198592202e9b734e8d..59a5681949c7f7fa507ed12726915c63ed406d3c 100644 --- a/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java +++ b/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java @@ -6,6 +6,7 @@ import java.nio.file.Files; import java.util.ArrayList; import java.util.List; +import de.tobias.utils.util.OS; import de.tobias.utils.util.SystemUtils; import net.minidev.json.JSONArray; import net.minidev.json.JSONObject; @@ -41,8 +42,6 @@ public class UpdateRegistery { private static final String URL = "url"; private static final String EXECUTE_FILE = "executePath"; - - public static String buildParamaterString(String downloadPath) { JSONObject data = new JSONObject(); data.put(DOWNLOAD_PATH, downloadPath); @@ -64,12 +63,19 @@ public class UpdateRegistery { String json = data.toJSONString(JSONStyle.MAX_COMPRESS); return json; } - + public static boolean needsAdminPermission() { for (Updatable updatable : availableUpdates) { if (!Files.isWritable(updatable.getLocalPath())) { return true; } + if (OS.isWindows()) { + try { + if (Files.getOwner(updatable.getLocalPath()).getName().toLowerCase().contains("admin")) { + return true; + } + } catch (IOException e) {} + } } return false; }