mirror of
https://github.com/open-goal/jak-project
synced 2026-08-21 14:54:53 -04:00
goalc/repl: Allow hot-loading files via ml with just the object name (#2036)
This allows you to not have to define the entire file path to a source file to re-compile and load it. Technically a stop-gap until editor tools are developed around writing OpenGOAL.  As opposed to `(ml "goal_src/jak2/engine/game/main.gc")` (which still works) This is accomplished via the following config (connection attempts is irrelevant): ```json { "numConnectToTargetAttempts": 1, "jak2": { "asmFileSearchDirs": [ "goal_src/jak2" ] } } ``` This also provides a way to make game-specific configurations for the REPL fairly easily.
This commit is contained in:
@@ -321,10 +321,23 @@ std::string base_name(const std::string& filename) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return filename.substr(pos);
|
||||
}
|
||||
|
||||
std::string base_name_no_ext(const std::string& filename) {
|
||||
size_t pos = 0;
|
||||
ASSERT(!filename.empty());
|
||||
for (size_t i = filename.size() - 1; i-- > 0;) {
|
||||
if (filename.at(i) == '/' || filename.at(i) == '\\') {
|
||||
pos = (i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::string file_name = filename.substr(pos);
|
||||
return file_name.substr(0, file_name.find_last_of('.'));
|
||||
;
|
||||
}
|
||||
|
||||
void ISONameFromAnimationName(char* dst, const char* src) {
|
||||
// The Animation Name is a bunch of words separated by dashes
|
||||
|
||||
@@ -529,7 +542,7 @@ std::vector<fs::path> find_files_recursively(const fs::path& base_dir, const std
|
||||
std::vector<fs::path> files = {};
|
||||
for (auto& p : fs::recursive_directory_iterator(base_dir)) {
|
||||
if (p.is_regular_file()) {
|
||||
if (std::regex_match(fs::path(p.path()).filename().string(), pattern)) {
|
||||
if (std::regex_match(p.path().filename().string(), pattern)) {
|
||||
files.push_back(p.path());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user