2013-12-23 01:12:31 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
2013-12-23 02:45:13 +00:00
|
|
|
#include <string>
|
2013-12-28 20:04:56 +00:00
|
|
|
#include "util/name.h"
|
2013-12-23 01:12:31 +00:00
|
|
|
namespace lean {
|
2014-06-16 22:50:27 +00:00
|
|
|
/** \brief Initialize the lean_path for the given kernel instance */
|
|
|
|
void init_lean_path(char const * kernel_instance_name);
|
|
|
|
/** \brief Return the LEAN_PATH string */
|
2013-12-23 01:56:53 +00:00
|
|
|
char const * get_lean_path();
|
2013-12-23 02:45:13 +00:00
|
|
|
/**
|
|
|
|
\brief Search the file \c fname in the LEAN_PATH. Throw an
|
|
|
|
exception if the file was not found.
|
|
|
|
*/
|
2013-12-28 20:04:56 +00:00
|
|
|
std::string find_file(std::string fname);
|
2013-12-29 01:31:35 +00:00
|
|
|
std::string find_file(std::string fname, std::initializer_list<char const *> const & exts);
|
|
|
|
|
2014-06-16 23:37:46 +00:00
|
|
|
/** \brief Hierarchical names are converted into paths using the path separator. Example: foo.bar is converted into foo/bar */
|
|
|
|
std::string find_file(name const & fname);
|
|
|
|
std::string find_file(name const & fname, std::initializer_list<char const *> const & exts);
|
2013-12-29 01:31:35 +00:00
|
|
|
|
2014-08-03 02:47:55 +00:00
|
|
|
/** \brief \brief Similar to previous find_file, but if k is not none then search at the k-th parent of base. */
|
2014-08-03 03:03:51 +00:00
|
|
|
std::string find_file(std::string const & base, optional<unsigned> const & rel, name const & fname,
|
|
|
|
std::initializer_list<char const *> const & extensions);
|
2014-08-03 02:47:55 +00:00
|
|
|
std::string find_file(std::string const & base, optional<unsigned> const & k, name const & fname, char const * ext);
|
|
|
|
|
2013-12-28 20:04:56 +00:00
|
|
|
/** \brief Return true iff fname ends with ".lean" */
|
|
|
|
bool is_lean_file(std::string const & fname);
|
|
|
|
/** \brief Return true iff fname ends with ".olean" */
|
|
|
|
bool is_olean_file(std::string const & fname);
|
|
|
|
/** \brief Return true iff fname ends with ".lua" */
|
|
|
|
bool is_lua_file(std::string const & fname);
|
|
|
|
|
|
|
|
/** \brief Return a string that replaces hierachical name separator '::' with a path separator. */
|
|
|
|
std::string name_to_file(name const & fname);
|
2014-06-29 00:43:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
\brief Auxiliary function for displaying a path.
|
|
|
|
In some platforms it will fix the notation used to display the path.
|
|
|
|
*/
|
|
|
|
void display_path(std::ostream & out, std::string const & fname);
|
2014-08-03 01:12:28 +00:00
|
|
|
|
|
|
|
std::string dirname(char const * fname);
|
|
|
|
std::string path_append(char const * path1, char const * path2);
|
2013-12-23 01:12:31 +00:00
|
|
|
}
|