Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Willers
KWSys
Commits
0983e8b5
Commit
0983e8b5
authored
21 years ago
by
Ken Martin
Browse files
Options
Downloads
Patches
Plain Diff
is there any chance thiswill work on all platforms hmmm added removeAdirectory
parent
82339c4d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SystemTools.cxx
+45
-3
45 additions, 3 deletions
SystemTools.cxx
SystemTools.hxx.in
+3
-0
3 additions, 0 deletions
SystemTools.hxx.in
with
48 additions
and
3 deletions
SystemTools.cxx
+
45
−
3
View file @
0983e8b5
...
...
@@ -13,6 +13,7 @@
=========================================================================*/
#include
"kwsysPrivate.h"
#include KWSYS_HEADER(SystemTools.hxx)
#include KWSYS_HEADER(Directory.hxx)
#include KWSYS_HEADER(std/iostream)
#include KWSYS_HEADER(std/fstream)
...
...
@@ -44,6 +45,10 @@ inline int Mkdir(const char* dir)
{
return
_mkdir
(
dir
);
}
inline
int
Rmdir
(
const
char
*
dir
)
{
return
_rmdir
(
dir
);
}
inline
const
char
*
Getcwd
(
char
*
buf
,
unsigned
int
len
)
{
return
_getcwd
(
buf
,
len
);
...
...
@@ -64,6 +69,10 @@ inline int Mkdir(const char* dir)
{
return
mkdir
(
dir
,
00777
);
}
inline
int
Rmdir
(
const
char
*
dir
)
{
return
rmdir
(
dir
);
}
inline
const
char
*
Getcwd
(
char
*
buf
,
unsigned
int
len
)
{
return
getcwd
(
buf
,
len
);
...
...
@@ -1005,6 +1014,38 @@ bool SystemTools::RemoveFile(const char* source)
return
unlink
(
source
)
!=
0
?
false
:
true
;
}
bool
SystemTools
::
RemoveADirectory
(
const
char
*
source
)
{
Directory
dir
;
dir
.
Load
(
source
);
size_t
fileNum
;
for
(
fileNum
=
0
;
fileNum
<
dir
.
GetNumberOfFiles
();
++
fileNum
)
{
if
(
strcmp
(
dir
.
GetFile
(
static_cast
<
unsigned
long
>
(
fileNum
)),
"."
)
&&
strcmp
(
dir
.
GetFile
(
static_cast
<
unsigned
long
>
(
fileNum
)),
".."
))
{
kwsys_std
::
string
fullPath
=
source
;
fullPath
+=
"/"
;
fullPath
+=
dir
.
GetFile
(
static_cast
<
unsigned
long
>
(
fileNum
));
if
(
SystemTools
::
FileIsDirectory
(
fullPath
.
c_str
()))
{
if
(
!
SystemTools
::
RemoveADirectory
(
fullPath
.
c_str
()))
{
return
false
;
}
}
else
{
if
(
!
SystemTools
::
RemoveFile
(
fullPath
.
c_str
()))
{
return
false
;
}
}
}
}
return
(
Rmdir
(
source
)
==
0
);
}
/**
* Find the file the given name. Searches the given path and then
...
...
@@ -1042,9 +1083,10 @@ kwsys_std::string SystemTools::FindFile(const char* name,
* the system search path. Returns the full path to the executable if it is
* found. Otherwise, the empty string is returned.
*/
kwsys_std
::
string
SystemTools
::
FindProgram
(
const
char
*
name
,
const
kwsys_std
::
vector
<
kwsys_std
::
string
>&
userPaths
,
bool
no_system_path
)
kwsys_std
::
string
SystemTools
::
FindProgram
(
const
char
*
name
,
const
kwsys_std
::
vector
<
kwsys_std
::
string
>&
userPaths
,
bool
no_system_path
)
{
if
(
!
name
)
{
...
...
This diff is collapsed.
Click to expand it.
SystemTools.hxx.in
+
3
−
0
View file @
0983e8b5
...
...
@@ -150,6 +150,9 @@ public:
///! Remove a file.
static bool RemoveFile(const char* source);
///! Remove a directory
static bool RemoveADirectory(const char* source);
///! Find a file in the system PATH, with optional extra paths.
static kwsys_std::string FindFile(const char* name,
const kwsys_std::vector<kwsys_std::string>& path= kwsys_std::vector<kwsys_std::string>());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment