Lines 15-20
Link Here
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 |
*/ |
16 |
*/ |
17 |
|
17 |
|
|
|
18 |
#include <sys/types.h> |
19 |
#include <sys/stat.h> |
20 |
#include <unistd.h> |
21 |
|
18 |
#include "file.h" |
22 |
#include "file.h" |
19 |
#include "fs.h" |
23 |
#include "fs.h" |
20 |
#include "game.h" |
24 |
#include "game.h" |
Lines 24-33
static const char *USAGE =
Link Here
|
24 |
"REminiscence - Flashback Interpreter\n" |
28 |
"REminiscence - Flashback Interpreter\n" |
25 |
"Usage: %s [OPTIONS]...\n" |
29 |
"Usage: %s [OPTIONS]...\n" |
26 |
" --datapath=PATH Path to data files (default 'DATA')\n" |
30 |
" --datapath=PATH Path to data files (default 'DATA')\n" |
27 |
" --savepath=PATH Path to save files (default '.')\n" |
31 |
" --savepath=PATH Path to save files (default '~/.reminiscence/')\n" |
28 |
" --levelnum=NUM Starting level (default '0')"; |
32 |
" --levelnum=NUM Starting level (default '0')"; |
29 |
|
33 |
|
30 |
static bool parseOption(const char *arg, const char *longCmd, const char **opt) { |
34 |
static bool parseOption(char *arg, const char *longCmd, char **opt) { |
31 |
bool handled = false; |
35 |
bool handled = false; |
32 |
if (arg[0] == '-' && arg[1] == '-') { |
36 |
if (arg[0] == '-' && arg[1] == '-') { |
33 |
if (strncmp(arg + 2, longCmd, strlen(longCmd)) == 0) { |
37 |
if (strncmp(arg + 2, longCmd, strlen(longCmd)) == 0) { |
Lines 83-91
static Language detectLanguage(FileSystem *fs) {
Link Here
|
83 |
|
87 |
|
84 |
#undef main |
88 |
#undef main |
85 |
int main(int argc, char *argv[]) { |
89 |
int main(int argc, char *argv[]) { |
86 |
const char *dataPath = "DATA"; |
90 |
struct stat sb; |
87 |
const char *savePath = "."; |
91 |
char *dataPath = "DATA"; |
88 |
const char *levelNum = "0"; |
92 |
char *savePath = (char *)malloc(256); |
|
|
93 |
|
94 |
snprintf(savePath, 255, "%s/.reminiscence", getenv("HOME")); |
95 |
|
96 |
if (stat(savePath, &sb)) { |
97 |
if (mkdir(savePath, 0755) == -1) { |
98 |
error("Unable to create %s directory", savePath); |
99 |
} |
100 |
} |
101 |
|
102 |
char *levelNum = "0"; |
89 |
for (int i = 1; i < argc; ++i) { |
103 |
for (int i = 1; i < argc; ++i) { |
90 |
bool opt = false; |
104 |
bool opt = false; |
91 |
if (strlen(argv[i]) >= 2) { |
105 |
if (strlen(argv[i]) >= 2) { |