|
a/upmpd/upmpdutils.cxx |
|
b/upmpd/upmpdutils.cxx |
|
... |
|
... |
197 |
o.replace(0, l+1, entry->pw_dir);
|
197 |
o.replace(0, l+1, entry->pw_dir);
|
198 |
}
|
198 |
}
|
199 |
return o;
|
199 |
return o;
|
200 |
}
|
200 |
}
|
201 |
|
201 |
|
|
|
202 |
bool path_makepath(const string& path, int mode)
|
|
|
203 |
{
|
|
|
204 |
if (path.empty() || path[0] != '/') {
|
|
|
205 |
return false;
|
|
|
206 |
}
|
|
|
207 |
vector<string> vpath;
|
|
|
208 |
stringToTokens(path, vpath, "/", true);
|
|
|
209 |
string npath;
|
|
|
210 |
for (auto& pelt : vpath) {
|
|
|
211 |
npath += string("/") + pelt;
|
|
|
212 |
if (access(npath.c_str(), 0) < 0) {
|
|
|
213 |
if (mkdir(npath.c_str(), mode)) {
|
|
|
214 |
return false;
|
|
|
215 |
}
|
|
|
216 |
}
|
|
|
217 |
}
|
|
|
218 |
return true;
|
|
|
219 |
}
|
|
|
220 |
|
202 |
void trimstring(string &s, const char *ws)
|
221 |
void trimstring(string &s, const char *ws)
|
203 |
{
|
222 |
{
|
204 |
string::size_type pos = s.find_first_not_of(ws);
|
223 |
string::size_type pos = s.find_first_not_of(ws);
|
205 |
if (pos == string::npos) {
|
224 |
if (pos == string::npos) {
|
206 |
s.clear();
|
225 |
s.clear();
|