Kaynağa Gözat

Create shared and game key specific shared directory

own3mall 8 yıl önce
ebeveyn
işleme
2e2e1e66e8
1 değiştirilmiş dosya ile 13 ekleme ve 0 silme
  1. 13 0
      OGP/ogp_agent.pl

+ 13 - 0
OGP/ogp_agent.pl

@@ -144,6 +144,13 @@ if (!-d SCREEN_LOGS_DIR && !mkdir SCREEN_LOGS_DIR)
 	exit -1;
 }
 
+# Check the global shared games folder
+if (!-d SHARED_GAME_TMP_DIR && !mkdir SHARED_GAME_TMP_DIR)
+{
+	logger "Could not create " . SHARED_GAME_TMP_DIR . " directory $!.", 1;
+	exit -1;
+}
+
 # Rotate the log file
 if (-e AGENT_LOG_FILE)
 {
@@ -497,6 +504,12 @@ sub replace_OGP_Env_Vars{
 	# Handle global game shared directory replacement
 	if(defined $game_key && $game_key ne ""){
 		my $shared_path = Path::Class::Dir->new(SHARED_GAME_TMP_DIR, $game_key);
+		# Create the folder if it doesn't exist
+		if (!-d $shared_path && !mkdir $shared_path)
+		{
+			logger "Could not create " . $shared_path . " directory $!.", 1;
+		}
+		
 		$exec_cmd =~ s/{OGP_GAME_SHARED_DIR}/$shared_path/g;
 	}