Do not create a config dir for migration when no config files nor dirs

This commit is contained in:
Akira TAGOH 2013-09-02 20:51:46 +09:00
parent d2bb1a8381
commit 3e5f70a16a
1 changed files with 10 additions and 5 deletions

View File

@ -2233,11 +2233,6 @@ FcParseInclude (FcConfigParse *parse)
/* No config dir nor file on the XDG directory spec compliant place /* No config dir nor file on the XDG directory spec compliant place
* so need to guess what it is supposed to be. * so need to guess what it is supposed to be.
*/ */
FcChar8 *parent = FcStrDirname (s);
if (!FcFileIsDir (parent))
FcMakeDirectory (parent);
FcStrFree (parent);
if (FcStrStr (s, (const FcChar8 *)"conf.d") != NULL) if (FcStrStr (s, (const FcChar8 *)"conf.d") != NULL)
goto userdir; goto userdir;
else else
@ -2259,6 +2254,11 @@ FcParseInclude (FcConfigParse *parse)
{ {
if (FcFileIsDir (filename)) if (FcFileIsDir (filename))
{ {
FcChar8 *parent = FcStrDirname (userdir);
if (!FcFileIsDir (parent))
FcMakeDirectory (parent);
FcStrFree (parent);
if (FcFileIsDir (userdir) || if (FcFileIsDir (userdir) ||
rename ((const char *)filename, (const char *)userdir) != 0 || rename ((const char *)filename, (const char *)userdir) != 0 ||
symlink ((const char *)userdir, (const char *)filename) != 0) symlink ((const char *)userdir, (const char *)filename) != 0)
@ -2272,6 +2272,11 @@ FcParseInclude (FcConfigParse *parse)
} }
else else
{ {
FcChar8 *parent = FcStrDirname (userconf);
if (!FcFileIsDir (parent))
FcMakeDirectory (parent);
FcStrFree (parent);
if (FcFileIsFile (userconf) || if (FcFileIsFile (userconf) ||
rename ((const char *)filename, (const char *)userconf) != 0 || rename ((const char *)filename, (const char *)userconf) != 0 ||
symlink ((const char *)userconf, (const char *)filename) != 0) symlink ((const char *)userconf, (const char *)filename) != 0)