diff options
Diffstat (limited to 'Tests/BundleTest/BundleLib.cxx')
-rw-r--r-- | Tests/BundleTest/BundleLib.cxx | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/Tests/BundleTest/BundleLib.cxx b/Tests/BundleTest/BundleLib.cxx index 54f9534d02..9ae802f5bb 100644 --- a/Tests/BundleTest/BundleLib.cxx +++ b/Tests/BundleTest/BundleLib.cxx @@ -8,13 +8,12 @@ int fileExists(char* filename) { #ifndef R_OK -# define R_OK 04 +#define R_OK 04 #endif - if ( access(filename, R_OK) != 0 ) - { + if (access(filename, R_OK) != 0) { printf("Cannot find file: %s\n", filename); return 0; - } + } return 1; } @@ -28,18 +27,15 @@ int findBundleFile(char* exec, const char* file) printf("Process executable name: %s\n", exec); // Remove the executable name and directory name - for ( cc = strlen(nexec)-1; cc > 0; cc -- ) - { - if ( nexec[cc] == '/' ) - { + for (cc = strlen(nexec) - 1; cc > 0; cc--) { + if (nexec[cc] == '/') { nexec[cc] = 0; - if ( cnt == 1 ) - { + if (cnt == 1) { break; - } - cnt ++; } + cnt++; } + } printf("Process executable path: %s\n", nexec); sprintf(fpath, "%s/%s", nexec, file); printf("Check for file: %s\n", fpath); @@ -49,22 +45,19 @@ int findBundleFile(char* exec, const char* file) return res; } -int foo(char *exec) +int foo(char* exec) { // Call a CoreFoundation function... // CFBundleRef br = CFBundleGetMainBundle(); - (void) br; + (void)br; int res1 = findBundleFile(exec, "Resources/randomResourceFile.plist"); int res2 = findBundleFile(exec, "MacOS/SomeRandomFile.txt"); int res3 = findBundleFile(exec, "MacOS/README.rst"); - if ( !res1 || - !res2 || - !res3 ) - { + if (!res1 || !res2 || !res3) { return 1; - } + } return 0; } |