Skip to content

Commit

Permalink
SDL_GetPrefPath for files
Browse files Browse the repository at this point in the history
  • Loading branch information
BttrDrgn committed May 12, 2022
1 parent 145ed11 commit 1fcda8c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/utils/fs/fs.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once

#ifndef HELPER
#include <SDL.h>
#endif

#include <fstream>
#include <filesystem>

Expand All @@ -18,7 +22,12 @@ class fs

static void write(const std::string& path, const std::string& contents)
{
std::ofstream ofs(path);
#ifndef HELPER
std::string full_path = logger::va("%s/%s", SDL_GetPrefPath("BttrDrgn", "radio.garten"), path);
#else
std::string full_path = path;
#endif
std::ofstream ofs(full_path);
ofs << contents;
ofs.close();
}
Expand Down

0 comments on commit 1fcda8c

Please sign in to comment.