Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
4ded1ae6
Commit
4ded1ae6
authored
Nov 28, 2022
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/FileSystem: add CreateDirectoryNoThrow()
parent
1da974e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
FileSystem.hxx
src/fs/FileSystem.hxx
+10
-0
StandardDirectory.cxx
src/fs/StandardDirectory.cxx
+1
-1
No files found.
src/fs/FileSystem.hxx
View file @
4ded1ae6
...
...
@@ -67,6 +67,16 @@ StatFile(Path file, struct stat &buf, bool follow_symlinks = true)
#endif
static
inline
bool
CreateDirectoryNoThrow
(
Path
path
)
noexcept
{
#ifdef _WIN32
return
CreateDirectory
(
path
.
c_str
(),
nullptr
);
#else
return
mkdir
(
path
.
c_str
(),
0777
);
#endif
}
/**
* Truncate a file that exists already. Throws std::system_error on
* error.
...
...
src/fs/StandardDirectory.cxx
View file @
4ded1ae6
...
...
@@ -314,7 +314,7 @@ GetAppRuntimeDir() noexcept
#ifdef USE_XDG
if
(
const
auto
user_dir
=
GetUserRuntimeDir
();
!
user_dir
.
IsNull
())
{
auto
dir
=
user_dir
/
app_filename
;
mkdir
(
dir
.
c_str
(),
0777
);
CreateDirectoryNoThrow
(
dir
);
return
dir
;
}
#endif
...
...
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