-
Notifications
You must be signed in to change notification settings - Fork 0
/
c4p_old.rb
70 lines (57 loc) · 1.87 KB
/
c4p_old.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env ruby
userpath = File.expand_path("~") #allows me to get user path.
#Resolving Arguments
if ARGV[0].nil?
then puts "You must at least supply a Bottle Name (in quotes) as an argument." ; return
end
ARGV[1].nil? ? bottle_name = ARGV[0] : bottle_name = ARGV[1]
#Allows for this input -o Quicken 2011 without quotes.
unless ARGV[2].nil?
bottle_name = bottle_name + " " + ARGV[2]
puts bottle_name
end
#Figures out if you have only one cx and defaults to it otherwise uses flags
if ( FileTest.directory?("#{userpath}/.cxoffice") and FileTest.directory?("#{userpath}/.cxgames") )
then
case ARGV[0].to_s
when "-cxg"
cx = "cxgames"
when "-cx"
cx = "cxoffice"
when "-g"
cx = "cxgames"
when "-o"
cx = "cxoffice"
else
puts "Assuming you meant Cross Over (Office)."
cx = "cxoffice"
end
elsif FileTest.directory?("#{userpath}/.cxoffice")
cx = "cxoffice"
puts "Assuming cxoffice."
elsif FileTest.directory?("#{userpath}/.cxgames")
cx = "cxgames"
puts "Assuming cxgames."
else
puts "Do you have CrossOver installed?"
return
end
#Check if bottle_name exists
unless FileTest.directory?("#{userpath}/.#{cx}/#{bottle_name}")
puts "ERROR: Directory #{bottle_name} doesn't exist."
puts "If your bottle name has spaces you must use quotes or add a -cx or -cxg flag."
return
end
#/opt/ or other directory for cx office/games
if FileTest.directory?("/opt/#{cx}")
cxpath = "/opt/#{cx}"
elsif FileTest.directory?("#{userpath}/.#{cx}/bin/")
cxpath = "#{userpath}/.#{cx}"
else
puts "Can't find your cx wine directory."
return
end
puts `#{cxpath}/bin/wine --bottle "#{bottle_name}" ~/.#{cx}/#{bottle_name}/drive_c/windows/system32/uninstaller.exe --list`
#Goal:
# "(path to cxoffice directory) /opt/bin/wine --bottle "(bottle name)"
# ~/.cxoffice/(bottle name)/drive_c/windows/system32/uninstaller.exe --list"