Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-2pick
Commits
aea069de
Commit
aea069de
authored
Jan 22, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no sort files in server mode
parent
87825311
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
gframe/myfilesystem.h
gframe/myfilesystem.h
+14
-0
No files found.
gframe/myfilesystem.h
View file @
aea069de
...
...
@@ -111,10 +111,12 @@ public:
return
MakeDir
(
dir
);
}
#ifndef YGOPRO_SERVER_MODE
struct
file_unit
{
std
::
string
filename
;
bool
is_dir
;
};
#endif
static
void
TraversalDir
(
const
char
*
path
,
const
std
::
function
<
void
(
const
char
*
,
bool
)
>&
cb
)
{
DIR
*
dir
=
nullptr
;
...
...
@@ -122,25 +124,36 @@ public:
if
((
dir
=
opendir
(
path
))
==
nullptr
)
return
;
struct
stat
fileStat
;
#ifndef YGOPRO_SERVER_MODE
std
::
vector
<
file_unit
>
file_list
;
#endif
while
((
dirp
=
readdir
(
dir
))
!=
nullptr
)
{
#ifndef YGOPRO_SERVER_MODE
file_unit
funit
;
#endif
char
fname
[
1024
];
strcpy
(
fname
,
path
);
strcat
(
fname
,
"/"
);
strcat
(
fname
,
dirp
->
d_name
);
stat
(
fname
,
&
fileStat
);
#ifdef YGOPRO_SERVER_MODE
cb
(
dirp
->
d_name
,
S_ISDIR
(
fileStat
.
st_mode
));
#else
funit
.
filename
=
std
::
string
(
dirp
->
d_name
);
funit
.
is_dir
=
S_ISDIR
(
fileStat
.
st_mode
);
file_list
.
push_back
(
funit
);
#endif
}
closedir
(
dir
);
#ifndef YGOPRO_SERVER_MODE
std
::
sort
(
file_list
.
begin
(),
file_list
.
end
(),
TraversalDirSort
);
for
(
file_unit
funit
:
file_list
)
cb
(
funit
.
filename
.
c_str
(),
funit
.
is_dir
);
#endif
}
#ifndef YGOPRO_SERVER_MODE
static
bool
TraversalDirSort
(
file_unit
file1
,
file_unit
file2
)
{
if
(
file1
.
is_dir
!=
file2
.
is_dir
)
{
return
file1
.
is_dir
;
...
...
@@ -148,6 +161,7 @@ public:
return
file1
.
filename
<
file2
.
filename
;
}
}
#endif
static
void
TraversalDir
(
const
wchar_t
*
wpath
,
const
std
::
function
<
void
(
const
wchar_t
*
,
bool
)
>&
cb
)
{
char
path
[
1024
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment