DEVTOOLS: Fix Visual Studio compilation for create_engine
This commit is contained in:
parent
3b3817823c
commit
c245ef0603
1 changed files with 16 additions and 0 deletions
|
@ -25,7 +25,11 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Specified engine name with different cases
|
// Specified engine name with different cases
|
||||||
#define MAX_LINE_LENGTH 256
|
#define MAX_LINE_LENGTH 256
|
||||||
|
@ -176,10 +180,18 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
char prefix[100];
|
char prefix[100];
|
||||||
char prefix2[100];
|
char prefix2[100];
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
if (GetFileAttributesA("../../engines") != INVALID_FILE_ATTRIBUTES) {
|
||||||
|
#else
|
||||||
if (!access("../../engines", F_OK)) {
|
if (!access("../../engines", F_OK)) {
|
||||||
|
#endif
|
||||||
strcpy(prefix, "../..");
|
strcpy(prefix, "../..");
|
||||||
strcpy(prefix2, ".");
|
strcpy(prefix2, ".");
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
} else if (GetFileAttributesA("engines") != INVALID_FILE_ATTRIBUTES) {
|
||||||
|
#else
|
||||||
} else if (!access("engines", F_OK)) {
|
} else if (!access("engines", F_OK)) {
|
||||||
|
#endif
|
||||||
strcpy(prefix, ".");
|
strcpy(prefix, ".");
|
||||||
strcpy(prefix2, "devtools/create_engine");
|
strcpy(prefix2, "devtools/create_engine");
|
||||||
} else {
|
} else {
|
||||||
|
@ -195,7 +207,11 @@ int main(int argc, char *argv[]) {
|
||||||
printf("Creating directory %s...", folder);
|
printf("Creating directory %s...", folder);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
if (!CreateDirectoryA(folder, NULL)) {
|
||||||
|
#else
|
||||||
if (mkdir(folder, 0755)) {
|
if (mkdir(folder, 0755)) {
|
||||||
|
#endif
|
||||||
printf("Could not create engine folder.\n");
|
printf("Could not create engine folder.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue