Skip to content

Commit a65bcc1

Browse files
committed
feat: search HOSHI_HOME in the first place
1 parent dd41102 commit a65bcc1

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

share/def.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
//
44

55
#include <cstdio>
6+
#include <cstdlib>
67
#include <filesystem>
78
#include <fstream>
89
#include <iostream>
910
#include <share/def.hpp>
11+
#include <stdlib.h>
1012

1113
namespace yoi {
1214
thread_local yoi::wstr __current_file_path = L"";
@@ -170,11 +172,15 @@ namespace yoi {
170172
std::string path;
171173
int length, dirnameLength;
172174

173-
length = wai_getExecutablePath(nullptr, 0, &dirnameLength);
174-
path.resize(length + 1);
175-
wai_getExecutablePath(path.data(), length, &dirnameLength);
176-
path[length] = '\0';
177-
return yoi::string2wstring(
178-
path.substr(0, path.rfind(std::filesystem::path::preferred_separator)));
175+
if (auto e = getenv("HOSHI_HOME"); e != nullptr) {
176+
return string2wstring(e) + L"/bin";
177+
} else {
178+
length = wai_getExecutablePath(nullptr, 0, &dirnameLength);
179+
path.resize(length + 1);
180+
wai_getExecutablePath(path.data(), length, &dirnameLength);
181+
path[length] = '\0';
182+
return yoi::string2wstring(
183+
path.substr(0, path.rfind(std::filesystem::path::preferred_separator)));
184+
}
179185
}
180186
} // namespace yoi

share/defines.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef HOSHI_LANG_DEFINES_H
22
#define HOSHI_LANG_DEFINES_H
33

4-
#define HOSHI_LANG_VERSION "86"
5-
#define HOSHI_LANG_GIT_COMMIT_HASH "c382a2"
4+
#define HOSHI_LANG_VERSION "87"
5+
#define HOSHI_LANG_GIT_COMMIT_HASH "dd4110"
66

77
#endif

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
86
1+
87

0 commit comments

Comments
 (0)