diff options
author | Damien George <damien.p.george@gmail.com> | 2014-06-07 00:05:59 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-06-07 00:05:59 +0100 |
commit | c61be8e1e10a8c7bac3161cae531d26a9d754825 (patch) | |
tree | fb28b5441e0b6e932478cd8b626862ad1b185df7 /unix | |
parent | 180751fbf38c4b6152fc53df3d35b6f9fecac2e7 (diff) | |
parent | df3ab0799486612245ed1708b84d2b1595311ae8 (diff) | |
download | micropython-c61be8e1e10a8c7bac3161cae531d26a9d754825.tar.gz micropython-c61be8e1e10a8c7bac3161cae531d26a9d754825.zip |
Merge pull request #662 from stinos/windows-pathsep
unix: Fix path seperator used depending on OS
Diffstat (limited to 'unix')
-rw-r--r-- | unix/main.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/unix/main.c b/unix/main.c index 7c3fbf6aa1..26736e4318 100644 --- a/unix/main.c +++ b/unix/main.c @@ -261,6 +261,12 @@ void pre_process_options(int argc, char **argv) { } } +#ifdef _WIN32 +#define PATHLIST_SEP_CHAR ';' +#else +#define PATHLIST_SEP_CHAR ':' +#endif + int main(int argc, char **argv) { volatile int stack_dummy; stack_top = (char*)&stack_dummy; @@ -281,7 +287,7 @@ int main(int argc, char **argv) { path = "~/.micropython/lib:/usr/lib/micropython"; } uint path_num = 1; // [0] is for current dir (or base dir of the script) - for (char *p = path; p != NULL; p = strchr(p, ':')) { + for (char *p = path; p != NULL; p = strchr(p, PATHLIST_SEP_CHAR)) { path_num++; if (p != NULL) { p++; @@ -293,7 +299,7 @@ int main(int argc, char **argv) { path_items[0] = MP_OBJ_NEW_QSTR(MP_QSTR_); char *p = path; for (int i = 1; i < path_num; i++) { - char *p1 = strchr(p, ':'); + char *p1 = strchr(p, PATHLIST_SEP_CHAR); if (p1 == NULL) { p1 = p + strlen(p); } |