Sane C++ Libraries
C++ Platform Abstraction Libraries
FileSystemDirectories.h
1// Copyright (c) Stefano Cristiano
2// SPDX-License-Identifier: MIT
3#pragma once
4#include "../Strings/SmallString.h"
5
6namespace SC
7{
8struct SC_COMPILER_EXPORT FileSystemDirectories;
9} // namespace SC
10
13
16{
18 StringView getExecutablePath() const { return executableFile.view(); }
19
22 StringView getApplicationPath() const { return applicationRootDirectory.view(); }
23
26 [[nodiscard]] bool init();
27
28 private:
29 static const int StaticPathSize = 1024 * sizeof(native_char_t);
30
31 SmallString<StaticPathSize> executableFile;
32 SmallString<StaticPathSize> applicationRootDirectory;
33};
34
#define SC_COMPILER_EXPORT
Macro for symbol visibility in non-MSVC compilers.
Definition: Compiler.h:78
char native_char_t
The native char for the platform (wchar_t (4 bytes) on Windows, char (1 byte) everywhere else )
Definition: PrimitiveTypes.h:34
Reports location of system directories (executable / application root)
Definition: FileSystemDirectories.h:16
StringView getExecutablePath() const
Absolute executable path with extension (UTF16 on Windows, UTF8 elsewhere)
Definition: FileSystemDirectories.h:18
bool init()
Initializes the paths.
StringView getApplicationPath() const
Absolute Application path with extension (UTF16 on Windows, UTF8 elsewhere)
Definition: FileSystemDirectories.h:22
String with compile time configurable inline storage (small string optimization)
Definition: SmallString.h:21
Non-owning view over a range of characters with UTF Encoding.
Definition: StringView.h:47