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.


![image](https://user-images.githubusercontent.com/13153231/203196148-de61cf4b-42c8-43dc-a7fd-80e6ba6f5ac2.png)

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:
Tyler Wilding
2022-11-29 19:22:22 -05:00
committed by GitHub
parent cdb61f69f8
commit ac3c4e59b0
13 changed files with 170 additions and 34 deletions
+24
View File
@@ -0,0 +1,24 @@
#include "StringUtil.h"
namespace str_util {
const std::string WHITESPACE = " \n\r\t\f\v";
bool starts_with(const std::string& s, const std::string& prefix) {
return s.rfind(prefix) == 0;
}
std::string ltrim(const std::string& s) {
size_t start = s.find_first_not_of(WHITESPACE);
return (start == std::string::npos) ? "" : s.substr(start);
}
std::string rtrim(const std::string& s) {
size_t end = s.find_last_not_of(WHITESPACE);
return (end == std::string::npos) ? "" : s.substr(0, end + 1);
}
std::string trim(const std::string& s) {
return rtrim(ltrim(s));
}
} // namespace str_util