Commit 2d127940 authored by nanahira's avatar nanahira

unfinished

parent 2bba7e6e
...@@ -113,6 +113,7 @@ public: ...@@ -113,6 +113,7 @@ public:
struct file_unit { struct file_unit {
std::string filename; std::string filename;
std::wstring filename_wide;
bool is_dir; bool is_dir;
}; };
...@@ -127,11 +128,14 @@ public: ...@@ -127,11 +128,14 @@ public:
{ {
file_unit funit; file_unit funit;
char fname[1024]; char fname[1024];
wchar_t dname_wide[1024];
strcpy(fname, path); strcpy(fname, path);
strcat(fname, "/"); strcat(fname, "/");
strcat(fname, dirp->d_name); strcat(fname, dirp->d_name);
stat(fname, &fileStat); stat(fname, &fileStat);
funit.filename = std::string(dirp->d_name); funit.filename = std::string(dirp->d_name);
BufferIO::DecodeUTF8(dirp->d_name, dname_wide);
funit.filename_wide = std::wstring(dname_wide);
funit.is_dir = S_ISDIR(fileStat.st_mode); funit.is_dir = S_ISDIR(fileStat.st_mode);
file_list.push_back(funit); file_list.push_back(funit);
} }
...@@ -145,7 +149,7 @@ public: ...@@ -145,7 +149,7 @@ public:
if(file1.is_dir != file2.is_dir) { if(file1.is_dir != file2.is_dir) {
return file1.is_dir; return file1.is_dir;
} else { } else {
return file1.filename < file2.filename; return file1.filename_wide < file2.filename_wide;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment