Skip to content

Commit ddc612c

Browse files
author
hannemann
committed
Sync: create syncdir on startup, remove debug message
1 parent 28006e2 commit ddc612c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

restfulapi.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ bool cPluginRestfulapi::Start(void)
134134

135135
FileCaches::get(); //cache files
136136

137+
string syncDir = Settings::get()->CacheDirectory() + "/sync";
138+
FileExtension::get()->exists(syncDir) || system(("mkdir -p " + syncDir).c_str());
139+
if (!FileExtension::get()->exists(syncDir)) {
140+
esyslog("restfulapi: error creating sync directory: %s", syncDir.c_str());
141+
} else {
142+
isyslog("restfulapi: using sync directory: %s", syncDir.c_str());
143+
}
144+
137145
serverThread.Initialize();
138146
serverThread.Start();
139147
return true;
@@ -151,16 +159,13 @@ void cPluginRestfulapi::Housekeeping(void)
151159
{
152160
// Perform any cleanup or other regular tasks.
153161

154-
// TODO: create sync dir if not exists
155-
156162
string cacheDir = Settings::get()->CacheDirectory();
157163
string syncDir = cacheDir + "/sync";
158164
string cmd = "find " + syncDir + " -type f -mtime +5 -delete";
159165
int result = system(cmd.c_str());
160166
if (result > 0) {
161167
esyslog("restfulapi: error cleaning up outdated syncfiles: %s", cmd.c_str());
162168
}
163-
dsyslog("restfulapi: cleaning up outdated syncfiles: %s", cmd.c_str());
164169
}
165170

166171
void cPluginRestfulapi::MainThreadHook(void)

0 commit comments

Comments
 (0)