aboutsummaryrefslogtreecommitdiff
path: root/include/Storage.hpp
blob: 362448f0d69a27a205126b1e047f2c9b83016c53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once

#include "Path.hpp"
#include <functional>
#include <filesystem>

namespace QuickMedia {
    // Return false to stop the iterator
    using FileIteratorCallback = std::function<bool(const std::filesystem::path &filepath)>;

    enum class FileType {
        FILE_NOT_FOUND,
        REGULAR,
        DIRECTORY
    };

    Path get_home_dir();
    Path get_storage_dir();
    Path get_cache_dir();
    int create_directory_recursive(const Path &path);
    FileType get_file_type(const Path &path);
    int file_get_content(const Path &path, std::string &result);
    int file_overwrite(const Path &path, const std::string &data);
    int create_lock_file(const Path &path);
    void for_files_in_dir(const Path &path, FileIteratorCallback callback);
    void for_files_in_dir_sort_last_modified(const Path &path, FileIteratorCallback callback);
}