Blender V4.3
StringUtils.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10// soc #include <qfileinfo.h>
11
12#include "StringUtils.h"
13#include "FreestyleConfig.h"
14
15#include "BLI_sys_types.h"
16
18
19void getPathName(const string &path, const string &base, vector<string> &pathnames)
20{
21 string dir;
22 string res;
23 char cleaned[FILE_MAX];
24 uint size = path.size();
25
26 pathnames.push_back(base);
27
28 for (uint pos = 0, sep = path.find(Config::PATH_SEP, pos); pos < size;
29 pos = sep + 1, sep = path.find(Config::PATH_SEP, pos))
30 {
31 if (sep == uint(string::npos)) {
32 sep = size;
33 }
34
35 dir = path.substr(pos, sep - pos);
36
37 STRNCPY(cleaned, dir.c_str());
38 BLI_path_normalize(cleaned);
39 res = string(cleaned);
40
41 if (!base.empty()) {
42 res += Config::DIR_SEP + base;
43 }
44
45 pathnames.push_back(res);
46 }
47}
48
49} // namespace Freestyle::StringUtils
#define FILE_MAX
int BLI_path_normalize(char *path) ATTR_NONNULL(1)
#define STRNCPY(dst, src)
Definition BLI_string.h:593
unsigned int uint
Configuration definitions.
String utilities.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
static const string DIR_SEP("/")
static const string PATH_SEP(":")
void getPathName(const string &path, const string &base, vector< string > &pathnames)