-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
275 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
** EPITECH PROJECT, 2020 | ||
** bomberman | ||
** File description: | ||
** Created by phil on 6/14/20 | ||
*/ | ||
|
||
#include <iostream> | ||
#include "AssetSelector.hpp" | ||
|
||
fs::path AssetSelector(const std::string &asset) { | ||
fs::path AssetPath; | ||
|
||
#if defined(ASSET_SELECTOR_RELEASE) && defined(__linux__) | ||
if (fs::current_path() == std::getenv("HOME")) | ||
AssetPath = "/usr/share/IndieStudio/"; | ||
else | ||
std::cerr << "not in installed mode (with package)" << std::endl; | ||
#endif | ||
|
||
#if defined(ASSET_SELECTOR_RELEASE) && defined(_WIN32) | ||
std::cout << "win32 implementation will go here" << std::endl; | ||
#endif | ||
|
||
if (AssetPath.empty()) { | ||
AssetPath = fs::current_path(); | ||
std::cout << "current path: " << AssetPath << std::endl; | ||
fs::path tmp = AssetPath; | ||
tmp /= "assets"; | ||
if (!fs::exists(tmp)) { | ||
std::cout << tmp << "does not exist" << std::endl; | ||
AssetPath = AssetPath.parent_path(); | ||
} | ||
} | ||
|
||
std::cout << "current path: " << AssetPath << std::endl; | ||
AssetPath /= asset; | ||
|
||
return AssetPath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
** EPITECH PROJECT, 2020 | ||
** bomberman | ||
** File description: | ||
** Created by phil on 6/14/20 | ||
*/ | ||
|
||
#ifndef BOMBERMAN_ASSETSELECTOR_HPP | ||
#define BOMBERMAN_ASSETSELECTOR_HPP | ||
|
||
#include <filesystem> | ||
#include <string> | ||
|
||
namespace fs = std::filesystem; | ||
|
||
fs::path AssetSelector(const std::string &asset); | ||
|
||
#endif //BOMBERMAN_ASSETSELECTOR_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
cmake_minimum_required(VERSION 3.11) | ||
|
||
# project name | ||
project(asset_selector) | ||
|
||
# c++ standard | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED on) | ||
|
||
# define macros to use in code depending on build type | ||
IF (CMAKE_BUILD_TYPE STREQUAL Debug) | ||
add_definitions(-DASSET_SELECTOR_DEBUG) | ||
ENDIF (CMAKE_BUILD_TYPE STREQUAL Debug) | ||
|
||
IF (CMAKE_BUILD_TYPE STREQUAL Release) | ||
add_definitions(-DASSET_SELECTOR_RELEASE) | ||
ENDIF (CMAKE_BUILD_TYPE STREQUAL Release) | ||
|
||
# define sources | ||
set(SRCS | ||
AssetSelector.cpp | ||
AssetSelector.hpp) | ||
|
||
# define the binary output | ||
add_library(${PROJECT_NAME} ${SRCS}) | ||
|
||
# expose the headers | ||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
# define the external libraries to use | ||
target_link_libraries(${PROJECT_NAME} exception) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.