* 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:
|
public:
|
||||||
|
|
||||||
virtual void read(const string& dir) {
|
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) {
|
if (dip) {
|
||||||
dirent *dit;
|
dirent *dit;
|
||||||
while (dit = ::dirread(dip)) {
|
while ((dit = ::readdir(dip))) {
|
||||||
if (dit->d_type == DT_DIR) {
|
if (dit->d_type == DT_DIR) {
|
||||||
dir_reader::add_dir(dit->d_name);
|
dir_reader::add_dir(dit->d_name);
|
||||||
} else {
|
} else {
|
||||||
|
@ -194,22 +194,18 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string& convert(string& path) {
|
void convert(string& path) {
|
||||||
string converted = path;
|
string::size_type pos = path.find('\\');
|
||||||
|
|
||||||
string::size_type pos = converted.find('\\');
|
|
||||||
while (pos != string::npos) {
|
while (pos != string::npos) {
|
||||||
converted[pos] = '/';
|
path[pos] = '/';
|
||||||
pos = converted.find('\\');
|
pos = path.find('\\');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Replace drive letter X: by /x */
|
/* Replace drive letter X: by /x */
|
||||||
if (converted[1] == ':') {
|
if (path[1] == ':') {
|
||||||
converted[1] = ::tolower(converted[0]);
|
path[1] = ::tolower(path[0]);
|
||||||
converted[0] = '/';
|
path[0] = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
return converted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue