File: filesystem_helper.cpp

package info (click to toggle)
libime 1.1.10%2Bdict20250327-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 51,572 kB
  • sloc: cpp: 40,251; ansic: 951; python: 77; sh: 32; makefile: 11
file content (26 lines) | stat: -rw-r--r-- 493 bytes parent folder | download | duplicates (2)
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
/*
 * SPDX-FileCopyrightText: 2024~2024 CSSlayer <wengxt@gmail.com>
 *
 * 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