Browse Source

Create and update server version indicator

Creates a .server-version file that specifies the network patch version.
Used to notify incron of completed dumps.
nosoop 7 years ago
parent
commit
a8b9f7b09e
1 changed files with 9 additions and 5 deletions
  1. 9 5
      scripting/csrd_data_dump.sp

+ 9 - 5
scripting/csrd_data_dump.sp

@@ -13,7 +13,7 @@
 #include <stocksoup/files>
 #include <stocksoup/version>
 
-#define PLUGIN_VERSION "1.0.0"
+#define PLUGIN_VERSION "1.1.0"
 public Plugin myinfo = {
 	name = "[CSRD] SRCDS Automatic Data Dumper",
 	author = "nosoop",
@@ -120,10 +120,14 @@ void PerformDataDump() {
 	// match expr /^[A-Za-z0-9_]+ - [A-Za-z0-9_]+$/
 	ServerCommand("sm_dump_classes %s/%d.classes.txt", outputDirectory, version);
 	
-	/**
-	 * TODO touch .server-version file in REDUMP_OUTPUT_DIRECTORY to notify incron of completed
-	 * dump
-	 */
+	// Create and update a .server-version file to notify incron of updates
+	char updatePath[PLATFORM_MAX_PATH];
+	BuildPath(Path_SM, updatePath, sizeof(updatePath), "%s/%s", REDUMP_OUTPUT_DIRECTORY,
+			".server-version");
+	
+	File versionFile = OpenFile(updatePath, "w");
+	versionFile.WriteLine("%d", version);
+	delete versionFile;
 }
 
 #if defined _steamtools_included