Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1d5adff0
Commit
1d5adff0
authored
Dec 03, 2005
by
Aric Stewart
Committed by
Alexandre Julliard
Dec 03, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wcmd: mkdir recursive create
In at least both win2k and winxp mkdir from the command prompt can recursively create full directory paths. This implements that functionality.
parent
d0713d28
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
1 deletion
+48
-1
builtins.c
programs/wcmd/builtins.c
+48
-1
No files found.
programs/wcmd/builtins.c
View file @
1d5adff0
...
...
@@ -150,11 +150,58 @@ char string[8], outpath[MAX_PATH], inpath[MAX_PATH], *infile;
* WCMD_create_dir
*
* Create a directory.
*
* this works recursivly. so mkdir dir1\dir2\dir3 will create dir1 and dir2 if
* they do not already exist.
*/
BOOL
create_full_path
(
CHAR
*
path
)
{
int
len
;
CHAR
*
new_path
;
BOOL
ret
=
TRUE
;
new_path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
path
)
+
1
);
strcpy
(
new_path
,
path
);
while
((
len
=
strlen
(
new_path
))
&&
new_path
[
len
-
1
]
==
'\\'
)
new_path
[
len
-
1
]
=
0
;
while
(
!
CreateDirectory
(
new_path
,
NULL
))
{
CHAR
*
slash
;
DWORD
last_error
=
GetLastError
();
if
(
last_error
==
ERROR_ALREADY_EXISTS
)
break
;
if
(
last_error
!=
ERROR_PATH_NOT_FOUND
)
{
ret
=
FALSE
;
break
;
}
if
(
!
(
slash
=
strrchr
(
new_path
,
'\\'
))
&&
!
(
slash
=
strrchr
(
new_path
,
'/'
)))
{
ret
=
FALSE
;
break
;
}
len
=
slash
-
new_path
;
new_path
[
len
]
=
0
;
if
(
!
create_full_path
(
new_path
))
{
ret
=
FALSE
;
break
;
}
new_path
[
len
]
=
'\\'
;
}
HeapFree
(
GetProcessHeap
(),
0
,
new_path
);
return
ret
;
}
void
WCMD_create_dir
(
void
)
{
if
(
!
CreateDirectory
(
param1
,
NULL
))
WCMD_print_error
();
if
(
!
create_full_path
(
param1
))
WCMD_print_error
();
}
/****************************************************************************
...
...
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