# 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")
# 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")
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