Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
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
List
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
nanahira
ygopro
Commits
dbd35d1a
Commit
dbd35d1a
authored
May 09, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing functions in myfilesystem in Linux/Mac
parent
9806dea0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
gframe/myfilesystem.h
gframe/myfilesystem.h
+49
-0
No files found.
gframe/myfilesystem.h
View file @
dbd35d1a
...
@@ -75,6 +75,12 @@ public:
...
@@ -75,6 +75,12 @@ public:
return
SHFileOperationW
(
&
lpFileOp
)
==
0
;
return
SHFileOperationW
(
&
lpFileOp
)
==
0
;
}
}
static
bool
DeleteDir
(
const
char
*
dir
)
{
wchar_t
wdir
[
1024
];
BufferIO
::
DecodeUTF8
(
dir
,
wdir
);
return
DeleteDir
(
wdir
);
}
static
void
TraversalDir
(
const
wchar_t
*
wpath
,
const
std
::
function
<
void
(
const
wchar_t
*
,
bool
)
>&
cb
)
{
static
void
TraversalDir
(
const
wchar_t
*
wpath
,
const
std
::
function
<
void
(
const
wchar_t
*
,
bool
)
>&
cb
)
{
wchar_t
findstr
[
1024
];
wchar_t
findstr
[
1024
];
wcscpy
(
findstr
,
wpath
);
wcscpy
(
findstr
,
wpath
);
...
@@ -137,6 +143,47 @@ public:
...
@@ -137,6 +143,47 @@ public:
return
MakeDir
(
dir
);
return
MakeDir
(
dir
);
}
}
static
bool
Rename
(
const
wchar_t
*
woldname
,
const
wchar_t
*
wnewname
)
{
char
oldname
[
1024
];
char
newname
[
1024
];
BufferIO
::
EncodeUTF8
(
woldname
,
oldname
);
BufferIO
::
EncodeUTF8
(
wnewname
,
newname
);
return
Rename
(
oldname
,
newname
);
}
static
bool
Rename
(
const
char
*
oldname
,
const
char
*
newname
)
{
return
rename
(
oldname
,
newname
)
==
0
;
}
static
bool
DeleteDir
(
const
wchar_t
*
wdir
)
{
char
dir
[
1024
];
BufferIO
::
EncodeUTF8
(
wdir
,
dir
);
return
DeleteDir
(
dir
);
}
static
bool
DeleteDir
(
const
char
*
dir
)
{
bool
success
=
true
;
TraversalDir
(
dir
,
[
dir
,
&
success
](
const
char
*
name
,
bool
isdir
)
{
if
(
strcmp
(
name
,
"."
)
==
0
||
strcmp
(
name
,
".."
)
==
0
)
return
;
char
full_path
[
256
];
sprintf
(
full_path
,
"%s/%s"
,
dir
,
name
);
if
(
isdir
)
{
if
(
!
DeleteDir
(
full_path
))
success
=
false
;
}
else
{
if
(
unlink
(
full_path
)
!=
0
)
success
=
false
;
}
});
if
(
rmdir
(
dir
)
!=
0
)
success
=
false
;
return
success
;
}
struct
file_unit
{
struct
file_unit
{
std
::
string
filename
;
std
::
string
filename
;
bool
is_dir
;
bool
is_dir
;
...
@@ -158,6 +205,8 @@ public:
...
@@ -158,6 +205,8 @@ public:
stat
(
fname
,
&
fileStat
);
stat
(
fname
,
&
fileStat
);
funit
.
filename
=
std
::
string
(
dirp
->
d_name
);
funit
.
filename
=
std
::
string
(
dirp
->
d_name
);
funit
.
is_dir
=
S_ISDIR
(
fileStat
.
st_mode
);
funit
.
is_dir
=
S_ISDIR
(
fileStat
.
st_mode
);
if
(
funit
.
is_dir
&&
(
strcmp
(
dirp
->
d_name
,
"."
)
==
0
||
strcmp
(
dirp
->
d_name
,
".."
)
==
0
))
continue
;
file_list
.
push_back
(
funit
);
file_list
.
push_back
(
funit
);
}
}
closedir
(
dir
);
closedir
(
dir
);
...
...
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