<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -28,6 +28,12 @@ require 'fileutils'
 !!!!   INITIAL SETUP   !!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!
 =end
+
+# Verify to see if user is root.
+if ENV['USER'] != 'root' then
+	raise StandardError, &quot;You must run this as root!&quot;
+end
+
 # Determine whether or not the device is running 2.0 (darwin9)
 # or 1.1.x (darwin8) by seeing if AppStore exists.
 if Dir.entries(&quot;/Applications&quot;).include?(&quot;AppStore.app&quot;) then
@@ -312,25 +318,10 @@ def thcp(base, full)
 	end
 end
 
-
-def theme_special(f, basename, app, filename)
-	@f = f
-	@basename = basename
-	@app = app
-	@filename = filename
-	if f == @app then
-		if Dir.entries(&quot;#{SR}/#{ARGV[1]}/Icons&quot;).include?(@basename) then
-			print &quot;*** #{@f} - #{@filename} ... &quot;
-			shaverify(@filename,@f,@basename)
-			print &quot;DONE \n&quot;
-		end
-	end	
-end
-
-def theme
+def theme(theme_name)
 	# Keep people from screwing their iPhones badly by verifying if the theme is Default.
 	raise StandardError, &quot;DO NOT USE SPRINGROLL THEME DEFAULT! If you want to restore your backup, use sr restore.&quot; if ARGV[1] == &quot;Default&quot;
-	puts &quot;* Theming interface with theme: #{ARGV[1]}&quot;
+	puts &quot;* Theming interface with theme: #{theme_name}&quot;
 
 	# Verify to see if the theme in question exists!
 	print &quot;** Does the theme even exist to begin with? ... &quot;
@@ -349,7 +340,7 @@ def theme
 		raise StandardError, &quot;Run sr backup to back things up for your own safety.&quot;
 	end
 
-	Dir.chdir(&quot;#{SR}/#{ARGV[1]}&quot;)
+	Dir.chdir(&quot;#{SR}/#{theme_name}&quot;)
 
 	# NON-ICON EXTRAS
 	# DOCK
@@ -402,7 +393,7 @@ def theme
 	end
 
 	# ICONS
-	if Dir.entries(&quot;/var/root/SpringRoll/#{ARGV[1]}&quot;).include?('Icons') then
+	if Dir.entries(&quot;/var/root/SpringRoll/#{theme_name}&quot;).include?('Icons') then
 		puts &quot;** Copying icons...&quot;
 		Dir.chdir('/Applications')
 		$apps = Dir.entries('/Applications')
@@ -412,82 +403,82 @@ def theme
 			if File.directory?(&quot;/Applications/#{$apps[0]}&quot;) then
 				Dir.chdir(&quot;/Applications/#{$apps[0]}&quot;)
 
-				def t_mobilemusicplayer
- 	       		         	if Dir.entries(&quot;#{SR}/#{ARGV[1]}/Icons&quot;).include?('MobileMusicPlayer-AudioPlayer.png') then
+				def t_mobilemusicplayer(theme_name)
+ 	       		         	if Dir.entries(&quot;#{SR}/#{theme_name}/Icons&quot;).include?('MobileMusicPlayer-AudioPlayer.png') then
 						print &quot;*** MobileMusicPlayer-AudioPlayer.png ... &quot;
-						FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/MobileMusicPlayer-AudioPlayer.png&quot;,&quot;/Applications/MobileMusicPlayer.app/icon-AudioPlayer.png&quot;)
+						FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/MobileMusicPlayer-AudioPlayer.png&quot;,&quot;/Applications/MobileMusicPlayer.app/icon-AudioPlayer.png&quot;)
 						print &quot;DONE \n&quot;
   	               		       	else
  	               	                	puts &quot;*** MobileMusicPlayer-AudioPlayer.png ... &quot;
                        			end
-					if Dir.entries(&quot;#{SR}/#{ARGV[1]}/Icons&quot;).include?('MobileMusicPlayer-MediaPlayer.png') then
+					if Dir.entries(&quot;#{SR}/#{theme_name}/Icons&quot;).include?('MobileMusicPlayer-MediaPlayer.png') then
 						print &quot;*** MobileMusicPlayer-MediaPlayer.png ... &quot;
-                       		         	FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/MobileMusicPlayer-MediaPlayer.png&quot;,&quot;/Applications/MobileMusicPlayer.app/icon-MediaPlayer.png&quot;)
+                       		         	FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/MobileMusicPlayer-MediaPlayer.png&quot;,&quot;/Applications/MobileMusicPlayer.app/icon-MediaPlayer.png&quot;)
                        		         	print &quot;DONE \n&quot;
                         		else
                                		 	puts &quot;*** MobileMusicPlayer-MediaPlayer.png ... NOT FOUND&quot;
                         		end
-					if Dir.entries(&quot;#{SR}/#{ARGV[1]}/Icons&quot;).include?('MobileMusicPlayer-VideoPlayer.png') then
+					if Dir.entries(&quot;#{SR}/#{theme_name}/Icons&quot;).include?('MobileMusicPlayer-VideoPlayer.png') then
 						print &quot;*** MobileMusicPlayer-VideoPlayer.png ... &quot;
-                                		FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/MobileMusicPlayer-VideoPlayer.png&quot;,&quot;/Applications/MobileMusicPlayer.app/icon-VideoPlayer.png&quot;)
+                                		FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/MobileMusicPlayer-VideoPlayer.png&quot;,&quot;/Applications/MobileMusicPlayer.app/icon-VideoPlayer.png&quot;)
                                 		print &quot;DONE \n&quot;
                         		else
                                 		puts &quot;*** MobileMusicPlayer-VideoPlayer.png ... NOT FOUND!&quot;
                         		end
                 		end
 
-                		def t_mobileslideshow
-					if Dir.entries(&quot;#{SR}/#{ARGV[1]}/Icons&quot;).include?('MobileSlideShow-Camera.png') then
+                		def t_mobileslideshow(theme_name)
+					if Dir.entries(&quot;#{SR}/#{theme_name}/Icons&quot;).include?('MobileSlideShow-Camera.png') then
 						print &quot;*** MobileSlideShow-Camera.png ... &quot;
-                                		FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/MobileSlideShow-Camera.png&quot;,&quot;/Applications/MobileSlideShow.app/icon-Camera.png&quot;)
+                                		FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/MobileSlideShow-Camera.png&quot;,&quot;/Applications/MobileSlideShow.app/icon-Camera.png&quot;)
                                 		print &quot;DONE \n&quot;
                         		else
                                 		puts &quot;*** MobileSlideShow-Camera.png ... NOT FOUND&quot;
                         		end
-					if Dir.entries(&quot;#{SR}/#{ARGV[1]}/Icons&quot;).include?('MobileSlideShow-Photos.png') then
+					if Dir.entries(&quot;#{SR}/#{theme_name}/Icons&quot;).include?('MobileSlideShow-Photos.png') then
 						print &quot;*** MobileSlideShow-Photos.png ... &quot;
-                                		FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/MobileSlideShow-Photos.png&quot;,&quot;/Applications/MobileSlideShow.app/icon-Photos.png&quot;)
+                                		FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/MobileSlideShow-Photos.png&quot;,&quot;/Applications/MobileSlideShow.app/icon-Photos.png&quot;)
                                 		print &quot;DONE \n&quot;
                         		else
                                 		puts &quot;*** MobileSlideShow-Photos.png ... NOT FOUND&quot;
                         		end
                 		end
 
-                		def t_others
+                		def t_others(theme_name)
 					basename = $apps[0].gsub('.app','.png')
 					if APPSTORE_IN_NORMALAPPS == true
 						# Does the theme have an icon for this app?
-						if File.exists?(&quot;#{SR}/#{ARGV[1]}/Icons/#{basename}&quot;) then
+						if File.exists?(&quot;#{SR}/#{theme_name}/Icons/#{basename}&quot;) then
 							# Is the theme an exception?
 							if Exceptions.has_key?($apps[0]) then
 								target = Exceptions.fetch($apps[0])
 								if target.is_a?String
 									print &quot;*** #{$apps[0]} - #{target} ... &quot;
-									FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/#{basename}&quot;,&quot;/Applications/#{$apps[0]}/#{target}&quot;)
+									FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/#{basename}&quot;,&quot;/Applications/#{$apps[0]}/#{target}&quot;)
 									puts &quot;DONE&quot;
 								elsif target.is_a?Array
 									target.each do |file|
 										print &quot;*** #{$apps[0]} - #{file} ... &quot;
-										FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/#{basename}&quot;,&quot;/Applications/#{$apps[0]}/#{file}&quot;)
+										FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/#{basename}&quot;,&quot;/Applications/#{$apps[0]}/#{file}&quot;)
 										puts &quot;DONE&quot;
 									end
 								end
 							else
 								if File.exists?(&quot;icon.png&quot;) then
 									print &quot;*** #{$apps[0]} - icon.png ... &quot;
-									FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/#{basename}&quot;,&quot;/Applications/#{$apps[0]}/icon.png&quot;)
+									FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/#{basename}&quot;,&quot;/Applications/#{$apps[0]}/icon.png&quot;)
 									puts &quot;DONE&quot;
 								elsif File.exists?(&quot;Icon.png&quot;) then
 									print &quot;*** #{$apps[0]} - Icon.png ... &quot;
-									FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/#{basename}&quot;,&quot;/Applications/#{$apps[0]}/Icon.png&quot;)
+									FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/#{basename}&quot;,&quot;/Applications/#{$apps[0]}/Icon.png&quot;)
 									puts &quot;DONE&quot;
 								end
 							end
 						end
 					else
 	                        		print &quot;*** #{$apps[0]} - icon.png ... &quot;
-						if Dir.entries(&quot;#{SR}/#{ARGV[1]}/Icons&quot;).include?(basename) then
-                                			FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/#{basename}&quot;,&quot;/Applications/#{$apps[0]}/icon.png&quot;)
+						if Dir.entries(&quot;#{SR}/#{theme_name}/Icons&quot;).include?(basename) then
+                                			FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/#{basename}&quot;,&quot;/Applications/#{$apps[0]}/icon.png&quot;)
                                 			puts &quot;DONE&quot;
                         			else
                                 			puts &quot;NOT FOUND!&quot;
@@ -496,9 +487,9 @@ def theme
                 		end
 
 				case $apps[0]
-					when &quot;MobileMusicPlayer.app&quot;: t_mobilemusicplayer
-					when &quot;MobileSlideShow.app&quot;: t_mobileslideshow
-					else t_others
+					when &quot;MobileMusicPlayer.app&quot;: t_mobilemusicplayer(theme_name)
+					when &quot;MobileSlideShow.app&quot;: t_mobileslideshow(theme_name)
+					else t_others(theme_name)
 				end
                 		$apps.shift
 			else
@@ -517,9 +508,9 @@ def theme
 			webclips.delete(&quot;..&quot;)
 			webclips.each do |wc|
 				Dir.chdir(&quot;/var/mobile/Library/WebClips/#{wc}&quot;)
-				if File.exists?(&quot;icon.png&quot;) and File.exists?(&quot;#{SR}/#{ARGV[1]}/Icons/#{wc_name}.png&quot;) then
+				if File.exists?(&quot;icon.png&quot;) and File.exists?(&quot;#{SR}/#{theme_name}/Icons/#{wc_name}.png&quot;) then
 					print &quot;*** #{wc_name} ... &quot;
-					FileUtils::cp(&quot;#{SR}/#{ARGV[1]}/Icons/#{wc_name}.png&quot;, &quot;/var/mobile/Library/WebClips/#{wc}/icon.png&quot;)
+					FileUtils::cp(&quot;#{SR}/#{theme_name}/Icons/#{wc_name}.png&quot;, &quot;/var/mobile/Library/WebClips/#{wc}/icon.png&quot;)
 					puts &quot;DONE&quot;
 				end
 			end
@@ -531,6 +522,7 @@ def theme
 	puts &quot;  Device will respring shortly.&quot;
 end
 
+
 =begin
 !!!!!!!!!!!!!!!!!!!!!
 !!!!   RESTORE   !!!!
@@ -691,17 +683,17 @@ def smbmv(old,new)
 	end
 end
 
-def smbconv
+def smbconv(theme_name)
 	# Verify to see if the theme even exists!
-	if Dir.entries(SR).include?(ARGV[1]) then
-		Dir.chdir(&quot;#{SR}/#{ARGV[1]}&quot;)
+	if File.exists? &quot;#{SR}/#{theme_name}&quot; then
+		Dir.chdir(&quot;#{SR}/#{theme_name}&quot;)
 		puts &quot;* Renaming status bar:&quot;
 		smbmv(&quot;StatusBar.png&quot;,&quot;StatusBar-FSO.png&quot;)
 		puts &quot;* Renaming icons:&quot;
 		# Don't break if the user's theme doesn't have
 		# an icons folder!
 		if File.exists?(&quot;Icons&quot;) then
-			Dir.chdir(&quot;#{SR}/#{ARGV[1]}/Icons&quot;)
+			Dir.chdir(&quot;#{SR}/#{theme_name}/Icons&quot;)
 			smbrenames = {
 				&quot;Calendar.png&quot; =&gt; &quot;MobileCal.png&quot;,
 				&quot;Camera.png&quot; =&gt; &quot;MobileSlideShow-Camera.png&quot;,
@@ -725,7 +717,7 @@ def smbconv
 			puts &quot;* WARNING! No icon directory found!&quot;
 		end
 		puts &quot;* Conversion complete!&quot;
-		puts &quot;  Use 'sr theme #{ARGV[1]}' to&quot;
+		puts &quot;  Use 'sr theme #{theme_name}' to&quot;
 		puts &quot;  apply this theme.&quot;
 	else
 		raise StandardError, &quot;The theme you've specified doesn't exist.&quot;
@@ -791,36 +783,32 @@ def theme_list
 	end
 end
 
-# ARGUMENT PROCESSING
-# To be phased out with GetoptLong in the future.
-def proceed(action)
-	# Verify to see if user is root.
-	if ENV['USER'] != 'root' then
-		raise StandardError, &quot;You must run this as root!&quot;
-	end
-	# Dispatch orders.
-	case action
-		when 'backup': backup # WORKING!
-		when 'theme': theme # WORKING!
-		when 'restore': restore # WORKING!
-		when 'smbconv': smbconv # WORKING!
-		when 'manualprep': manualprep
-	end
-end
+=begin
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!   ARGUMENT PROCESSING   !!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+=end
 
 case ARGV[0]
 	when nil: RDoc::usage
-	when 'r': proceed(restore)
-	when 't': proceed(theme)
-	when 'b': proceed(backup)
-	when 's': proceed(smbconv)
-	when 'm': proceed(manualprep)
-	when 'restore': proceed(restore)
-	when 'backup': proceed(backup)
-	when 'theme': proceed(theme)
-	when 'smbconv': proceed(smbconv)
+	when 'r': restore
+	when 't'
+		raise ArgumentError, &quot;Enter in a theme name.&quot; if ARGV[1].nil?
+		theme(ARGV[1])
+	when 'b': backup
+	when 's'
+		raise ArgumentError, &quot;Enter in a theme name.&quot; if ARGV[1].nil?
+		smbconv(ARGV[1])
+	when 'l': theme_list
+	when 'restore': restore
+	when 'backup': backup
+	when 'theme'
+		raise ArgumentError, &quot;Enter in a theme name.&quot; if ARGV[1].nil?
+		theme(ARGV[1])
+	when 'smbconv'
+		raise ArgumentError, &quot;Enter in a theme name.&quot; if ARGV[1].nil?
+		smbconv(ARGV[1])
 	when 'whatsnew': new
-	when 'manualprep': manualprep
 	when 'list': theme_list
 	else RDoc::usage
 end</diff>
      <filename>sr</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8d2b196da2831c4b89b1edfc1aeb1cf32ed09605</id>
    </parent>
  </parents>
  <author>
    <name>Yanik</name>
    <email>magnany@yaniks-imac.local</email>
  </author>
  <url>http://github.com/Sakurina/springroll/commit/45d687f5b69d3dfb40d328dc8d54ad0f1d2ec156</url>
  <id>45d687f5b69d3dfb40d328dc8d54ad0f1d2ec156</id>
  <committed-date>2008-07-31T18:28:39-07:00</committed-date>
  <authored-date>2008-07-31T18:28:39-07:00</authored-date>
  <message>Nearing an r8 release. Cleaned up the code so it's much nicer to read and changed the argument processing. Sadly, GetoptLong enforces hyphens. :(</message>
  <tree>0faf7eb02489b68444908897d93b676d89f24316</tree>
  <committer>
    <name>Yanik</name>
    <email>magnany@yaniks-imac.local</email>
  </committer>
</commit>
