Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Aayush
purr-data
Commits
d2fb06de
Commit
d2fb06de
authored
Oct 31, 2016
by
Albert Gräf
Browse files
Linux: Try to create the ~/.pd-l2ork config dir if necessary when saving the preferences file.
parent
4f367208
Changes
1
Hide whitespace changes
Inline
Side-by-side
pd/src/s_file.c
View file @
d2fb06de
...
...
@@ -139,10 +139,19 @@ static FILE *sys_prefsavefp;
static
void
sys_initsavepreferences
(
void
)
{
char
filenamebuf
[
FILENAME_MAX
],
*
homedir
=
getenv
(
"HOME"
);
FILE
*
fp
;
struct
stat
statbuf
;
if
(
!
homedir
)
return
;
snprintf
(
filenamebuf
,
FILENAME_MAX
,
"%s/.pd-l2ork"
,
homedir
);
filenamebuf
[
FILENAME_MAX
-
1
]
=
0
;
if
(
stat
(
filenamebuf
,
&
statbuf
)
||
!
S_ISDIR
(
statbuf
.
st_mode
))
{
// user config dir doesn't exist yet, try to create it
if
(
mkdir
(
filenamebuf
,
0755
))
{
pd_error
(
0
,
"%s: %s"
,
filenamebuf
,
strerror
(
errno
));
return
;
}
}
snprintf
(
filenamebuf
,
FILENAME_MAX
,
"%s/.pd-l2ork/user.settings"
,
homedir
);
filenamebuf
[
FILENAME_MAX
-
1
]
=
0
;
if
((
sys_prefsavefp
=
fopen
(
filenamebuf
,
"w"
))
==
NULL
)
...
...
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