[Scummvm-git-logs] scummvm master -> 3b3817823c155eb2c9f7bc73b313052f0f441416
sev-
noreply at scummvm.org
Wed May 18 20:43:49 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3b3817823c DEVTOOLS: Make create_engine run from scummvm root as well
Commit: 3b3817823c155eb2c9f7bc73b313052f0f441416
https://github.com/scummvm/scummvm/commit/3b3817823c155eb2c9f7bc73b313052f0f441416
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-05-18T22:43:42+02:00
Commit Message:
DEVTOOLS: Make create_engine run from scummvm root as well
Changed paths:
devtools/create_engine/create_engine.cpp
diff --git a/devtools/create_engine/create_engine.cpp b/devtools/create_engine/create_engine.cpp
index 0507cee0201..13f29c60ab9 100644
--- a/devtools/create_engine/create_engine.cpp
+++ b/devtools/create_engine/create_engine.cpp
@@ -25,6 +25,7 @@
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
+#include <unistd.h>
// Specified engine name with different cases
#define MAX_LINE_LENGTH 256
@@ -85,15 +86,15 @@ void process_file(FILE *in, FILE *out) {
}
// Copies and processes the specified file
-void process_file(const char *filename) {
+void process_file(const char *filename, const char *prefix, const char *prefix2) {
char srcFilename[128], destFilename[128];
- sprintf(srcFilename, "files/%s", filename);
+ sprintf(srcFilename, "%s/files/%s", prefix2, filename);
if (!strncmp(filename, "xyzzy.", 6))
- sprintf(destFilename, "../../engines/%s/%s.%s",
- engineLowercase, engineLowercase, filename + 6);
+ sprintf(destFilename, "%s/engines/%s/%s.%s",
+ prefix, engineLowercase, engineLowercase, filename + 6);
else
- sprintf(destFilename, "../../engines/%s/%s",
- engineLowercase, filename);
+ sprintf(destFilename, "%s/engines/%s/%s",
+ prefix, engineLowercase, filename);
printf("Creating file %s...", destFilename);
fflush(stdout);
@@ -120,17 +121,22 @@ void process_file(const char *filename) {
// For Visual Studio convenience, creates a copy of the
// create_msvc.bat to <engine>.bat that allows creating
// the ScummVM solution with just that engine enabled
-void create_batch_file() {
+void create_batch_file(const char *prefix) {
FILE *in, *out;
char line[MAX_LINE_LENGTH];
+ char destFilename[MAX_LINE_LENGTH];
- if (!(in = fopen("../../dists/msvc/create_msvc.bat", "r"))) {
+ sprintf(destFilename, "%s/dists/msvc/create_msvc.bat", prefix);
+ if (!(in = fopen(destFilename, "r"))) {
printf("Could not open create_msvc.bat\n");
exit(0);
}
- char destFilename[MAX_LINE_LENGTH];
- sprintf(destFilename, "../../dists/msvc/%s.bat", engineLowercase);
+ sprintf(destFilename, "%s/dists/msvc/%s.bat", prefix, engineLowercase);
+
+ printf("Creating file %s...", destFilename);
+ fflush(stdout);
+
if (!(out = fopen(destFilename, "w"))) {
printf("Could not create %s.bat\n", engineLowercase);
exit(0);
@@ -148,6 +154,8 @@ void create_batch_file() {
fputs(line, out);
}
+ printf("done\n");
+
fclose(in);
fclose(out);
}
@@ -166,11 +174,25 @@ int main(int argc, char *argv[]) {
engineUppercase[i] : engineLowercase[i];
}
+ char prefix[100];
+ char prefix2[100];
+ if (!access("../../engines", F_OK)) {
+ strcpy(prefix, "../..");
+ strcpy(prefix2, ".");
+ } else if (!access("engines", F_OK)) {
+ strcpy(prefix, ".");
+ strcpy(prefix2, "devtools/create_engine");
+ } else {
+ printf("Cound not locate engines directory. Run from the scummvm source root directory\n");
+ return 0;
+ }
+
+
// Create a directory for the new engine
char folder[MAX_LINE_LENGTH];
- sprintf(folder, "../../engines/%s", engineLowercase);
+ sprintf(folder, "%s/engines/%s", prefix, engineLowercase);
- printf("Creating directory ../../engines/%s...", engineLowercase);
+ printf("Creating directory %s...", folder);
fflush(stdout);
if (mkdir(folder, 0755)) {
@@ -181,9 +203,9 @@ int main(int argc, char *argv[]) {
// Process the files
for (const char *const *filename = FILENAMES; *filename; ++filename)
- process_file(*filename);
+ process_file(*filename, prefix, prefix2);
- create_batch_file();
+ create_batch_file(prefix);
printf("Engine generation complete.\n");
return 0;
More information about the Scummvm-git-logs
mailing list