![]() |
HAL
|
#include <project_directory.h>
Public Member Functions | |
ProjectDirectory (const std::string &path=std::string()) | |
std::filesystem::path | get_default_filename (const std::string &extension=std::string()) const |
std::filesystem::path | get_filename (const std::string &relative_filename) const |
std::filesystem::path | get_shadow_filename (const std::string &extension=std::string()) const |
std::filesystem::path | get_shadow_dir () const |
std::filesystem::path | get_canonical_path () const |
std::filesystem::path | get_relative_file_path (const std::string &filename) const |
Static Public Member Functions | |
static ProjectDirectory | generate_random () |
Static Public Attributes | |
static const std::string | s_shadow_dir = "autosave" |
Friends | |
class | ProjectManager |
Definition at line 37 of file project_directory.h.
hal::ProjectDirectory::ProjectDirectory | ( | const std::string & | path = std::string() | ) |
ProjectDirectory constructor.
path | - Path to hal project. If path has an extension (like .v or .hal) the extension will be removed. |
Definition at line 9 of file project_directory.cpp.
Referenced by generate_random().
|
static |
Generate a directory name in current working directory which contains a four digit random number
Definition at line 15 of file project_directory.cpp.
References ProjectDirectory().
Referenced by hal::project_manager_init().
std::filesystem::path hal::ProjectDirectory::get_canonical_path | ( | ) | const |
Project directories canonical path. Other than std::filesystem::canonical this method will return an empty path if no project path given.
Definition at line 31 of file project_directory.cpp.
Referenced by get_default_filename(), get_filename(), get_relative_file_path(), get_shadow_dir(), hal::project_manager_init(), and hal::PythonSerializer::serialize_control().
std::filesystem::path hal::ProjectDirectory::get_default_filename | ( | const std::string & | extension = std::string() | ) | const |
Returns the default file name which is a file with the same as the name as the project directory plus an extension.
[in] | extension | - Extension of default file name. If empty, '.hal' is assumed. |
Definition at line 38 of file project_directory.cpp.
References get_canonical_path(), and name.
Referenced by hal::ProjectManager::create_project_directory(), hal::FileManager::importFile(), hal::netlist_factory::load_netlist(), hal::FileManager::newProject(), hal::FileManager::openProject(), hal::project_manager_init(), and hal::ProjectManager::serialize_project().
std::filesystem::path hal::ProjectDirectory::get_filename | ( | const std::string & | relative_filename | ) | const |
Returns absolute path to file within project directory
[in] | relative_filename | - Relative file name in project directory. |
Definition at line 47 of file project_directory.cpp.
References get_canonical_path().
Referenced by hal::ProjectManager::create_project_directory(), hal::project_manager_init(), and hal::PythonSerializer::PythonSerializer().
std::filesystem::path hal::ProjectDirectory::get_relative_file_path | ( | const std::string & | filename | ) | const |
If filename is within project directory the relative file name will be returned. Otherwise this method will return parameter filename without modifications.
[in] | filename | - Absolute path to file |
Definition at line 74 of file project_directory.cpp.
References get_canonical_path(), and test::n.
Referenced by hal::project_manager_init().
std::filesystem::path hal::ProjectDirectory::get_shadow_dir | ( | ) | const |
Get autosave directory path
Definition at line 67 of file project_directory.cpp.
References get_canonical_path(), and s_shadow_dir.
Referenced by hal::FileManager::autosave(), get_shadow_filename(), hal::FileManager::openProject(), and hal::project_manager_init().
std::filesystem::path hal::ProjectDirectory::get_shadow_filename | ( | const std::string & | extension = std::string() | ) | const |
Similar to get_default_filename() but will return file name which is located in the autosave (aka shadow) directory.
[in] | extension | - Extension of shadow file name. If empty '.hal' is assumed |
Definition at line 58 of file project_directory.cpp.
References get_shadow_dir(), and name.
Referenced by hal::project_manager_init(), and hal::ProjectManager::serialize_project().
|
friend |
Definition at line 39 of file project_directory.h.
|
static |
Name of autosave subdirectory
Definition at line 111 of file project_directory.h.
Referenced by hal::ProjectManager::create_project_directory(), get_shadow_dir(), hal::project_manager_init(), and hal::ProjectManager::restore_project_file_from_autosave().