From 5e7e23a05651936c95da2781dd14f59dc99c172b Mon Sep 17 00:00:00 2001
From: tobias <tobias.ullerich@icloud.com>
Date: Tue, 12 Jul 2016 18:31:00 +0200
Subject: [PATCH] Change UpdateRegistery#needsAdminPermission

---
 .../de/tobias/playpad/update/UpdateRegistery.java    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java b/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java
index 2bef2a24..59a56819 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;
 	}
-- 
GitLab