windows: Improve default search path.

The default value for MICROPYPATH used in unix/main.c is
"~/.micropython/lib:/usr/lib/micropython" which has 2 problems when used in
the Windows port:
- it has a ':' as path separator but the port uses ';' so the entire string
  is effectively discarded since it gets interpreted as a single path which
  doesn't exist
- /usr/lib/micropython is not a valid path in a standard Windows
  environment

Override the value with a suitable default.
This commit is contained in:
stijn 2020-02-04 11:09:09 +01:00 committed by Damien George
parent 8b6e6008c7
commit 5f91933e54
2 changed files with 6 additions and 2 deletions

View File

@ -82,8 +82,9 @@ Environment variables
.. envvar:: MICROPYPATH .. envvar:: MICROPYPATH
Overrides the default search path for MicroPython libraries. ``MICROPYPATH`` Overrides the default search path for MicroPython libraries. ``MICROPYPATH``
should be set to a colon separated list of directories. If ``MICROPYPATH`` is should be set to a colon (semicolon for Windows port) separated list of
not defined, the search path will be ``~/.micropython/lib:/usr/lib/micropython`` directories. If ``MICROPYPATH`` is not defined, the search path will be
``~/.micropython/lib:/usr/lib/micropython`` (``~/.micropython/lib`` for Windows port)
or the value of the ``MICROPY_PY_SYS_PATH_DEFAULT`` option if it was set or the value of the ``MICROPY_PY_SYS_PATH_DEFAULT`` option if it was set
when MicroPython itself was compiled. when MicroPython itself was compiled.

View File

@ -81,6 +81,9 @@
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1) #define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
#define MICROPY_PY_SYS_EXIT (1) #define MICROPY_PY_SYS_EXIT (1)
#define MICROPY_PY_SYS_PLATFORM "win32" #define MICROPY_PY_SYS_PLATFORM "win32"
#ifndef MICROPY_PY_SYS_PATH_DEFAULT
#define MICROPY_PY_SYS_PATH_DEFAULT "~/.micropython/lib"
#endif
#define MICROPY_PY_SYS_MAXSIZE (1) #define MICROPY_PY_SYS_MAXSIZE (1)
#define MICROPY_PY_SYS_STDFILES (1) #define MICROPY_PY_SYS_STDFILES (1)
#define MICROPY_PY_SYS_EXC_INFO (1) #define MICROPY_PY_SYS_EXC_INFO (1)