-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make boost::filesystem optional (#81)
__GNUC__ doesn't work as intended on clang, change to another way to detect the presence of std::filesystem. Also make boost::filesystem fully optional. Co-authored-by: Weng Xuetian <[email protected]>
- Loading branch information
1 parent
2f5fb82
commit 003f74d
Showing
6 changed files
with
77 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024~2024 CSSlayer <[email protected]> | ||
* | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
*/ | ||
|
||
#include <string> | ||
#include <string_view> | ||
|
||
#ifdef HAS_STD_FILESYSTEM | ||
#include <filesystem> | ||
#else | ||
#include <boost/filesystem.hpp> | ||
#endif | ||
|
||
namespace libime { | ||
|
||
std::string absolutePath(const std::string &path) { | ||
#ifdef HAS_STD_FILESYSTEM | ||
return std::filesystem::absolute(path); | ||
#else | ||
return boost::filesystem::absolute(path).string(); | ||
#endif | ||
} | ||
|
||
} // namespace libime |
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,19 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024~2024 CSSlayer <[email protected]> | ||
* | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
*/ | ||
|
||
#ifndef _TOOLS_FILESYSTEM_HELPER_H_ | ||
#define _TOOLS_FILESYSTEM_HELPER_H_ | ||
|
||
#include <string> | ||
#include <string_view> | ||
|
||
namespace libime { | ||
|
||
std::string absolutePath(const std::string &path); | ||
|
||
} | ||
|
||
#endif |
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