1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2007 Christian Schoenebeck * |
* Copyright (C) 2007-2014 Christian Schoenebeck * |
4 |
* * |
* * |
5 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
6 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
27 |
|
|
28 |
namespace LinuxSampler { |
namespace LinuxSampler { |
29 |
|
|
30 |
Path::Path() : drive(0) { |
Path::Path() : drive(0), absolute(false) { |
31 |
|
} |
32 |
|
|
33 |
|
Path::Path(std::string path) { |
34 |
|
#if WIN32 |
35 |
|
*this = fromWindows(path); |
36 |
|
#else |
37 |
|
*this = fromPosix(path); |
38 |
|
#endif |
39 |
} |
} |
40 |
|
|
41 |
void Path::appendNode(std::string Name) { |
void Path::appendNode(std::string Name) { |
45 |
|
|
46 |
void Path::setDrive(const char& Drive) { |
void Path::setDrive(const char& Drive) { |
47 |
drive = Drive; |
drive = Drive; |
48 |
|
absolute = true; |
49 |
} |
} |
50 |
|
|
51 |
std::string Path::toPosix() const { |
std::string Path::toPosix() const { |
197 |
s.replace(pos, 3, pcAscii); |
s.replace(pos, 3, pcAscii); |
198 |
} |
} |
199 |
} |
} |
200 |
|
// check whether given string reflects an absolute path |
201 |
|
// (indicated by a forward slash as first character on POSIX) |
202 |
|
result.absolute = !path.empty() && path[0] == '/'; |
203 |
return result; |
return result; |
204 |
} |
} |
205 |
|
|
253 |
} |
} |
254 |
} |
} |
255 |
|
|
256 |
|
// check whether given string reflects an absolute path |
257 |
|
// (indicated either by a backslash or drive at the beginning on Windows) |
258 |
|
result.absolute = result.drive || (!path.empty() && path[0] == '\\'); |
259 |
|
|
260 |
return result; |
return result; |
261 |
} |
} |
262 |
|
|
314 |
return p.stripLastName(); |
return p.stripLastName(); |
315 |
} |
} |
316 |
|
|
317 |
|
bool Path::isAbsolute() const { |
318 |
|
return absolute; |
319 |
|
} |
320 |
|
|
321 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |