Exemple #1
0
void init_lean_path() {
#if defined(LEAN_EMSCRIPTEN)
    *g_lean_path = "/library";
    g_lean_path_vector->push_back(*g_lean_path);
#else
    char * r = getenv("LEAN_PATH");
    if (r == nullptr) {
        std::string exe_path = get_path(get_exe_location());
        *g_lean_path  = exe_path + g_sep + ".." + g_sep + "library";
        *g_lean_path += g_path_sep;
        *g_lean_path += exe_path + g_sep + ".." + g_sep + "lib" + g_sep + "lean";
        *g_lean_path += g_path_sep;
        *g_lean_path += ".";
    } else {
        *g_lean_path = r;
    }
    g_lean_path_vector->clear();
    *g_lean_path = normalize_path(*g_lean_path);
    unsigned i  = 0;
    unsigned j  = 0;
    unsigned sz = g_lean_path->size();
    for (; j < sz; j++) {
        if (is_path_sep((*g_lean_path)[j])) {
            if (j > i)
                g_lean_path_vector->push_back(g_lean_path->substr(i, j - i));
            i = j + 1;
        }
    }
    if (j > i)
        g_lean_path_vector->push_back(g_lean_path->substr(i, j - i));
#endif
}
Exemple #2
0
search_path get_builtin_search_path() {
    search_path path;
#if !defined(LEAN_EMSCRIPTEN)
    std::string exe_path = dirname(get_exe_location());
    path.push_back(exe_path + get_dir_sep() + ".." + get_dir_sep() + "library");
    path.push_back(exe_path + get_dir_sep() + ".." + get_dir_sep() + "lib" + get_dir_sep() + "lean" + get_dir_sep() + "library");
#endif
    return path;
}