* diropen, dirread -> opendir, readdir
* fixed warnings git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3789 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
f95af4cb45
commit
6c3ce8f436
1 changed files with 10 additions and 14 deletions
|
@ -176,12 +176,12 @@ class posix_dir_reader : public dir_reader {
|
|||
public:
|
||||
|
||||
virtual void read(const string& dir) {
|
||||
//string converted_dir = convert(dir);
|
||||
//convert(dir);
|
||||
|
||||
DIR *dip = ::diropen(dir.c_str());
|
||||
DIR *dip = ::opendir(dir.c_str());
|
||||
if (dip) {
|
||||
dirent *dit;
|
||||
while (dit = ::dirread(dip)) {
|
||||
while ((dit = ::readdir(dip))) {
|
||||
if (dit->d_type == DT_DIR) {
|
||||
dir_reader::add_dir(dit->d_name);
|
||||
} else {
|
||||
|
@ -194,22 +194,18 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
string& convert(string& path) {
|
||||
string converted = path;
|
||||
|
||||
string::size_type pos = converted.find('\\');
|
||||
void convert(string& path) {
|
||||
string::size_type pos = path.find('\\');
|
||||
while (pos != string::npos) {
|
||||
converted[pos] = '/';
|
||||
pos = converted.find('\\');
|
||||
path[pos] = '/';
|
||||
pos = path.find('\\');
|
||||
}
|
||||
|
||||
/* Replace drive letter X: by /x */
|
||||
if (converted[1] == ':') {
|
||||
converted[1] = ::tolower(converted[0]);
|
||||
converted[0] = '/';
|
||||
if (path[1] == ':') {
|
||||
path[1] = ::tolower(path[0]);
|
||||
path[0] = '/';
|
||||
}
|
||||
|
||||
return converted;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue