mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Try to create appdata dir if it doesn't exist (hopefully resolves #680)
This commit is contained in:
@@ -27,6 +27,18 @@
|
|||||||
|
|
||||||
#include "Filesystem.h"
|
#include "Filesystem.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
std::string getDriveRoot(const std::string &input)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < input.size(); ++i)
|
||||||
|
if (input[i] == '/' || input[i] == '\\')
|
||||||
|
return input.substr(0, i+1);
|
||||||
|
// Something's horribly wrong
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
{
|
{
|
||||||
namespace filesystem
|
namespace filesystem
|
||||||
@@ -153,15 +165,15 @@ bool Filesystem::setupWriteDirectory()
|
|||||||
|
|
||||||
// Set the appdata folder as writable directory.
|
// Set the appdata folder as writable directory.
|
||||||
// (We must create the save folder before mounting it).
|
// (We must create the save folder before mounting it).
|
||||||
if (!PHYSFS_setWriteDir(getAppdataDirectory()))
|
if (!PHYSFS_setWriteDir(getDriveRoot(getAppdataDirectory()).c_str()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Create the save folder. (We're now "at" %APPDATA%).
|
// Create the save folder. (We're now "at" %APPDATA%).
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (fused)
|
if (fused)
|
||||||
success = mkdir(save_identity.c_str());
|
success = mkdir(save_path_full.c_str());
|
||||||
else
|
else
|
||||||
success = mkdir(save_path_relative.c_str());
|
success = mkdir(save_path_full.c_str());
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user