]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Better servicemenu(de)installation
authorJonathan Schmidt-Dominé <git@the-user.org>
Wed, 2 Mar 2011 18:39:45 +0000 (19:39 +0100)
committerJonathan Schmidt-Dominé <git@the-user.org>
Wed, 2 Mar 2011 18:39:45 +0000 (19:39 +0100)
src/settings/services/servicemenudeinstallation
src/settings/services/servicemenuinstallation

index a1c71efa7edb7023d9ce1a49f6adef251017388c..24fd7bf10d1f7905249c4448c8c447d2081873d4 100755 (executable)
@@ -12,11 +12,18 @@ dir = archive + "-dir"
 # try: installKDE4
 # try: install.sh
 # try: install
-dd = Dir.new(dir)
-dd.read
-dd.read
-dir += "/" + dd.read
-dd = nil
+while true
+    dd = Dir.new(dir)
+    break if dd.count != 3
+    odir = dir
+    for entry in dd
+        dir += "/" + entry if entry != "." && entry != ".."
+    end
+    if !File.directory? dir
+        dir = odir
+        break
+    end
+end
 Dir.chdir(dir)
 def fail()
     system("kdialog --passivepopup \"Deinstallation failed\" 15")
index b99cc3b00eb3af05a561b21542e14ace11175d41..ac2cf8f1cc6cc9526b709abe35532d8232f86e7b 100755 (executable)
@@ -65,11 +65,18 @@ exit(-1) if !uncompress(archive, dir)
 # try: installKDE4
 # try: install.sh
 # try: install
-dd = Dir.new(dir)
-dd.read
-dd.read
-dir += "/" + dd.read
-dd = nil
+while true
+    dd = Dir.new(dir)
+    break if dd.count != 3
+    odir = dir
+    for entry in dd
+        dir += "/" + entry if entry != "." && entry != ".."
+    end
+    if !File.directory? dir
+        dir = odir
+        break
+    end
+end
 Dir.chdir(dir)
 def fail()
     system("kdialog --passivepopup \"Installation failed\" 15")
@@ -79,4 +86,4 @@ if !((File.exist?(file = "./install-it.sh") || File.exist?(file = "./install-it"
     fail() if !File.exist?(file = "./installKDE4.sh") && !File.exist?(file = "./installKDE4") && !File.exist?(file = "./install.sh") && !File.exist?(file = "./install")
     File.new(file).chmod(0700)
     fail() if !system(file + " --local") && !system(file + "--local-install") && !system(file + " --install")
-end
+end