devilutionX/Source/restrict.cpp
Jmgr d4f62870b8 Remove globals from paths.h
Fix for Vita

Update to use free functions

Use std::optional to allow setting empty paths

Change header inclusion order

Co-authored-by: Gleb Mazovetskiy <glex.spb@gmail.com>

Use std::optional to allow setting empty paths

Apply clang-format

Temporary commit
2021-04-25 22:26:37 +02:00

28 lines
566 B
C++

/**
* @file restrict.cpp
*
* Implementation of functionality for checking if the game will be able run on the system.
*/
#include "appfat.h"
#include "utils/paths.h"
namespace devilution {
/**
* @brief Check that we have write access to the game install folder
*/
void ReadOnlyTest()
{
const std::string path = paths::PrefPath() + "Diablo1ReadOnlyTest.foo";
FILE *f = fopen(path.c_str(), "wt");
if (f == nullptr) {
DirErrorDlg(paths::PrefPath().c_str());
}
fclose(f);
remove(path.c_str());
}
} // namespace devilution