Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
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
videolan
vlc
Commits
353cd0a0
Commit
353cd0a0
authored
May 07, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement utf8_rename
parent
493b6549
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
include/vlc_charset.h
include/vlc_charset.h
+1
-0
src/text/filesystem.c
src/text/filesystem.c
+35
-0
No files found.
include/vlc_charset.h
View file @
353cd0a0
...
...
@@ -49,6 +49,7 @@ VLC_EXPORT( int, utf8_loaddir, ( DIR *dir, char ***namelist, int (*select)( cons
VLC_EXPORT
(
int
,
utf8_scandir
,
(
const
char
*
dirname
,
char
***
namelist
,
int
(
*
select
)(
const
char
*
),
int
(
*
compar
)(
const
char
**
,
const
char
**
)
)
);
VLC_EXPORT
(
int
,
utf8_mkdir
,
(
const
char
*
filename
,
mode_t
mode
)
);
VLC_EXPORT
(
int
,
utf8_unlink
,
(
const
char
*
filename
)
);
int
utf8_rename
(
const
char
*
,
const
char
*
);
#if defined( WIN32 ) && !defined( UNDER_CE )
# define stat _stati64
...
...
src/text/filesystem.c
View file @
353cd0a0
...
...
@@ -450,6 +450,41 @@ int utf8_unlink( const char *filename )
return
ret
;
}
/**
* Moves a file atomically. This only works within a single file system.
*
* @param oldpath path to the file before the move
* @param newpath intended path to the file after the move
* @return A 0 return value indicates success. A -1 return value indicates an
* error, and an error code is stored in errno
*/
int
utf8_rename
(
const
char
*
oldpath
,
const
char
*
newpath
)
{
#if defined (WIN32)
CONVERT_PATH
(
oldpath
,
wold
,
-
1
);
CONVERT_PATH
(
newpath
,
wnew
,
-
1
);
return
_wrename
(
wold
,
wnew
);
#endif
const
char
*
lo
=
ToLocale
(
oldpath
);
if
(
lo
==
NULL
)
goto
error
;
const
char
*
ln
=
ToLocale
(
newpath
);
if
(
ln
==
NULL
)
{
LocaleFree
(
lo
);
error:
errno
=
ENOENT
;
return
-
1
;
}
int
ret
=
rename
(
lo
,
ln
);
LocaleFree
(
lo
);
LocaleFree
(
ln
);
return
ret
;
}
int
utf8_mkstemp
(
char
*
template
)
{
static
const
char
digits
[]
=
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
...
...
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