Elevate Engine
1
Loading...
Searching...
No Matches
Files.h
Go to the documentation of this file.
1
#pragma once
2
// TODO REMOVE WHITESPACE FROM THIS FILE
3
#include <
ElevateEngine/Core/Log.h
>
4
5
#ifdef _WIN32
6
#define WIN32_LEAN_AND_MEAN
7
#define NOMINMAX
8
#include <Windows.h>
9
#include <shellapi.h>
10
#endif
11
12
namespace
Elevate::Files
13
{
14
void
OpenWithDefaultApp
(
const
std::string& filePath) {
15
if
(std::filesystem::exists(filePath)) {
16
#ifdef _WIN32
17
// Windows
18
ShellExecuteA(NULL,
"open"
, filePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
19
#elif __APPLE__
20
// macOS
21
std::string command =
"open "
+ filePath +
" &"
;
22
system(command.c_str());
23
#elif __linux__
24
// Linux
25
std::string command =
"xdg-open "
+ filePath +
" &"
;
26
system(command.c_str());
27
#else
28
EE_CORE_ERROR(
"Unsupported OS"
);
29
#endif
30
}
31
else
{
32
EE_CORE_ERROR(
"ERROR - Cannot open file '{0}', file not found."
, filePath);
33
}
34
}
35
}
Log.h
Elevate::Files
Definition
Files.h:13
Elevate::Files::OpenWithDefaultApp
void OpenWithDefaultApp(const std::string &filePath)
Definition
Files.h:14
ElevateEngine
src
ElevateEngine
Core
Files.h
Generated by
1.9.8