]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/settings/services/servicemenuinstallation
make services GHNS work with store.kde.org
[dolphin.git] / src / settings / services / servicemenuinstallation
index b99cc3b00eb3af05a561b21542e14ace11175d41..36b9debd244c639e0911ff88d4001e020665780a 100755 (executable)
@@ -2,7 +2,7 @@
 require 'pathname'
 require 'fileutils'
 archive = ARGV[0]
-$servicedir = `kde4-config --localprefix`.strip! + "share/kde4/services/ServiceMenus/"
+$servicedir = `qtpaths --writable-path GenericDataLocation`.strip!  + "/kservices5/ServiceMenus/"
 FileUtils.mkdir_p($servicedir) if !File.exist?($servicedir)
 if archive[(archive.length - 8)..(archive.length - 1)] == ".desktop"
     puts "Single-File Service-Menu"
@@ -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