Просмотр исходного кода

Added login option and some other fixes for steam workshop subroutines

DieFeM 8 лет назад
Родитель
Сommit
6eafae7c03
1 измененных файлов с 16 добавлено и 10 удалено
  1. 16 10
      ogp_agent.pl

+ 16 - 10
ogp_agent.pl

@@ -4058,7 +4058,8 @@ sub steam_workshop_without_decrypt
 		$regex, $mods_backreference_index,
 		$variable, $place_after, $mod_string, 
 		$string_separator, $config_file_path, 
-		$post_install, $mod_names_list) = @_;
+		$post_install, $mod_names_list,
+		$anonymous_login, $user, $pass) = @_;
 	
 	# Creates mods path if it doesn't exist
 	if ( check_b4_chdir($mods_full_path) != 0)
@@ -4087,7 +4088,14 @@ sub steam_workshop_without_decrypt
 	open  FILE, '>', $installtxt;
 	print FILE "\@ShutdownOnFailedCommand 1\n";
 	print FILE "\@NoPromptForPassword 1\n";
-	print FILE "login anonymous\n";
+	if($anonymous_login eq "0")
+	{
+		print FILE "login $user $pass\n";
+	}
+	else
+	{
+		print FILE "login anonymous\n";
+	}
 	print FILE "force_install_dir \"$mods_full_path\"\n";
 	foreach my $workshop_mod (@workshop_mods)
 	{
@@ -4095,10 +4103,7 @@ sub steam_workshop_without_decrypt
 	}
 	print FILE "exit\n";
 	close FILE;
-	
-	my $log_file = Path::Class::File->new(SCREEN_LOGS_DIR, "screenlog.$screen_id");
-	backup_home_log($home_id, $log_file);
-	
+		
 	my $precmd = "";
 	my $postcmd = "";
 	
@@ -4166,7 +4171,7 @@ sub	generate_post_install_scripts
 	
 	$post_install_scripts .= 'if [ ! -e $config_file_path ];then'."\n".
 							 '	if [ ! -d "$(dirname $config_file_path)" ];then mkdir -p "$(dirname $config_file_path)";fi'."\n".
-							 '	echo -e "${place_after}${variable}" > $config_file_path'."\n".
+							 '	echo -e "${place_after}\n${variable}" > $config_file_path'."\n".
 							 'fi'."\n".
 							 'i=0'."\n".
 							 'for mod_id in "${workshop_mod_id[@]}"'."\n".
@@ -4199,10 +4204,11 @@ sub	generate_post_install_scripts
 							 '			echo -e "${file_content}${variable}${mod_string[$i]}">"$config_file_path"'."\n".
 							 '		else'."\n".
 							 '			if [ -z "${file_content##*${place_after}*}" ];then'."\n".
-							 '				new_var="${place_after}${variable}${mod_string[$i]}"'."\n".
-							 '				echo -e "${file_content/$place_after/$new_var}">"$config_file_path"'."\n".
+							 '				new_var="${variable}${mod_string[$i]}"'."\n".
+							 '				place_after_esc=$(echo -e "$place_after"|sed -e \'s/[]\\/$*.^[]/\\\\&/g\')'."\n".
+							 '				echo -e "$file_content"|sed \'/\'$place_after_esc\'/a \'$new_var>"$config_file_path"'."\n".
 							 '			else'."\n".
-							 '				echo -e "${file_content}${place_after}${variable}${mod_string[$i]}">"$config_file_path"'."\n".
+							 '				echo -e "${file_content}${place_after}\n${variable}${mod_string[$i]}">"$config_file_path"'."\n".
 							 '			fi'."\n".
 							 '		fi'."\n".
 							 '	fi'."\n".