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
b9f71276
Commit
b9f71276
authored
Oct 26, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/StandardDirectory: add GetAppRuntimeDir()
parent
1e6f5f01
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
5 deletions
+23
-5
Listen.cxx
src/Listen.cxx
+2
-5
StandardDirectory.cxx
src/fs/StandardDirectory.cxx
+14
-0
StandardDirectory.hxx
src/fs/StandardDirectory.hxx
+7
-0
No files found.
src/Listen.cxx
View file @
b9f71276
...
...
@@ -86,13 +86,10 @@ ListenXdgRuntimeDir(ClientListener &listener) noexcept
use $XDG_RUNTIME_DIR */
return
false
;
const
auto
xdg_runtime_dir
=
GetUser
RuntimeDir
();
if
(
xdg
_runtime_dir
.
IsNull
())
const
auto
mpd_runtime_dir
=
GetApp
RuntimeDir
();
if
(
mpd
_runtime_dir
.
IsNull
())
return
false
;
const
auto
mpd_runtime_dir
=
xdg_runtime_dir
/
Path
::
FromFS
(
"mpd"
);
mkdir
(
mpd_runtime_dir
.
c_str
(),
0700
);
const
auto
socket_path
=
mpd_runtime_dir
/
Path
::
FromFS
(
"socket"
);
unlink
(
socket_path
.
c_str
());
...
...
src/fs/StandardDirectory.cxx
View file @
b9f71276
...
...
@@ -292,6 +292,20 @@ GetUserRuntimeDir() noexcept
#endif
}
AllocatedPath
GetAppRuntimeDir
()
noexcept
{
#ifdef USE_XDG
if
(
const
auto
user_dir
=
GetUserRuntimeDir
();
!
user_dir
.
IsNull
())
{
auto
dir
=
user_dir
/
Path
::
FromFS
(
"mpd"
);
mkdir
(
dir
.
c_str
(),
0700
);
return
dir
;
}
#endif
return
nullptr
;
}
#ifdef _WIN32
AllocatedPath
...
...
src/fs/StandardDirectory.hxx
View file @
b9f71276
...
...
@@ -50,6 +50,13 @@ GetUserCacheDir() noexcept;
AllocatedPath
GetUserRuntimeDir
()
noexcept
;
/**
* Obtains the runtime directory for this application.
*/
[[
gnu
::
const
]]
AllocatedPath
GetAppRuntimeDir
()
noexcept
;
#ifdef _WIN32
/**
...
...
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