Skip to content

Commit bcdd75e

Browse files
committed
fix regression
1 parent 2270884 commit bcdd75e

File tree

8 files changed

+20
-16
lines changed

8 files changed

+20
-16
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ To install or update LODA, please follow the [installation instructions](https:/
22

33
## [Unreleased]
44

5+
# v22.6.6
6+
57
### Bugfixes
68

79
* Fix basic validation for updated programs

src/api_client.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ ApiClient::ApiClient()
2424
} else {
2525
Log::get().info("Using configured API server: " + server);
2626
}
27-
ensureTrailingSlash(server);
27+
if (server.back() != '/') {
28+
server += '/';
29+
}
2830
base_url = server + "miner/v1/";
2931
}
3032

src/boinc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void Boinc::run() {
1616
Log::get().error("PROJECT_DIR environment variable not set", true);
1717
}
1818
std::string slot_dir(project_env);
19-
ensureTrailingSlash(slot_dir);
19+
ensureTrailingFileSep(slot_dir);
2020

2121
// read slot init data
2222
auto init_data = readXML(slot_dir + "init_data.xml");
@@ -27,7 +27,7 @@ void Boinc::run() {
2727
Log::get().error("Invalid project data: " + slot_dir + "init_data.xml",
2828
true);
2929
}
30-
ensureTrailingSlash(project_dir);
30+
ensureTrailingFileSep(project_dir);
3131

3232
// log debugging info
3333
Log::get().info("Platform: " + Version::PLATFORM +

src/file.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void fixWindowsEnv() {
129129
if (p) {
130130
program_files = std::string(p);
131131
}
132-
ensureTrailingSlash(program_files);
132+
ensureTrailingFileSep(program_files);
133133
bool update = false;
134134
if (path.find("Git\\cmd") == std::string::npos) {
135135
if (!path.empty()) {
@@ -188,7 +188,7 @@ void makeExecutable(const std::string &path) {
188188
#endif
189189
}
190190

191-
void ensureTrailingSlash(std::string &dir) {
191+
void ensureTrailingFileSep(std::string &dir) {
192192
if (dir.back() != FILE_SEP) {
193193
dir += FILE_SEP;
194194
}
@@ -327,7 +327,7 @@ size_t getMemUsage() {
327327

328328
FolderLock::FolderLock(std::string folder) {
329329
// obtain lock
330-
ensureTrailingSlash(folder);
330+
ensureTrailingFileSep(folder);
331331
ensureDir(folder);
332332
lockfile = folder + "lock";
333333
fd = 0;

src/include/file.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void git(const std::string &folder, const std::string &args);
3232

3333
void makeExecutable(const std::string &path);
3434

35-
void ensureTrailingSlash(std::string &dir);
35+
void ensureTrailingFileSep(std::string &dir);
3636

3737
std::string getHomeDir();
3838

src/setup.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ std::string Setup::getLodaHomeNoCheck() {
6969
} else {
7070
result = getHomeDir() + FILE_SEP + "loda" + FILE_SEP;
7171
}
72-
ensureTrailingSlash(result);
72+
ensureTrailingFileSep(result);
7373
return result;
7474
}
7575

@@ -82,7 +82,7 @@ const std::string& Setup::getLodaHome() {
8282

8383
void Setup::setLodaHome(const std::string& home) {
8484
LODA_HOME = home;
85-
ensureTrailingSlash(LODA_HOME);
85+
ensureTrailingFileSep(LODA_HOME);
8686
checkDir(LODA_HOME);
8787
Log::get().info("Using LODA home directory \"" + LODA_HOME + "\"");
8888
}
@@ -126,7 +126,7 @@ void Setup::setMinersConfig(const std::string& loda_config) {
126126
const std::string& Setup::getOeisHome() {
127127
if (OEIS_HOME.empty()) {
128128
OEIS_HOME = getLodaHome() + "oeis" + FILE_SEP;
129-
ensureTrailingSlash(OEIS_HOME);
129+
ensureTrailingFileSep(OEIS_HOME);
130130
ensureDir(OEIS_HOME);
131131
}
132132
return OEIS_HOME;
@@ -142,7 +142,7 @@ const std::string& Setup::getProgramsHome() {
142142
void Setup::setProgramsHome(const std::string& home) {
143143
PROGRAMS_HOME = home;
144144
checkDir(PROGRAMS_HOME);
145-
ensureTrailingSlash(PROGRAMS_HOME);
145+
ensureTrailingFileSep(PROGRAMS_HOME);
146146
checkDir(PROGRAMS_HOME);
147147
}
148148

@@ -399,7 +399,7 @@ void Setup::checkLodaHome() {
399399
if (!line.empty()) {
400400
LODA_HOME = line;
401401
}
402-
ensureTrailingSlash(LODA_HOME);
402+
ensureTrailingFileSep(LODA_HOME);
403403
ensureDir(LODA_HOME);
404404
}
405405

src/stats.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Stats::Stats()
1616
num_ops_per_type(Operation::Types.size(), 0) {}
1717

1818
void Stats::load(std::string path) {
19-
ensureTrailingSlash(path);
19+
ensureTrailingFileSep(path);
2020
Log::get().debug("Loading program stats from " + path);
2121

2222
const std::string sep(",");
@@ -213,7 +213,7 @@ void Stats::load(std::string path) {
213213
}
214214

215215
void Stats::save(std::string path) {
216-
ensureTrailingSlash(path);
216+
ensureTrailingFileSep(path);
217217
Log::get().debug("Saving program stats to " + path);
218218

219219
const std::string sep(",");
@@ -307,7 +307,7 @@ void Stats::save(std::string path) {
307307
}
308308

309309
std::string Stats::getMainStatsFile(std::string path) const {
310-
ensureTrailingSlash(path);
310+
ensureTrailingFileSep(path);
311311
path += "constant_counts.csv";
312312
return path;
313313
}

src/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ void Test::stats() {
904904

905905
// save & reload stats
906906
std::string dir = getTmpDir() + "stats2";
907-
ensureTrailingSlash(dir);
907+
ensureTrailingFileSep(dir);
908908
ensureDir(dir);
909909
s.save(dir);
910910
t.load(dir);

0 commit comments

Comments
 (0)