File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -126,12 +126,28 @@ std::string Config::command() const
126
126
return cmd;
127
127
}
128
128
129
- static const char *startsWith (const char *arg, const char *start) {
129
+ static const char *startsWith (const char *arg, const char *start)
130
+ {
130
131
if (std::strncmp (arg, start, std::strlen (start)) != 0 )
131
132
return NULL ;
132
133
return arg + std::strlen (start);
133
134
}
134
135
136
+ static std::filesystem::path normalizePath (const std::filesystem::path path)
137
+ {
138
+ std::filesystem::path result;
139
+ for (auto component : path) {
140
+ if (component.string () == " ." )
141
+ continue ;
142
+ if (component.string () == " .." ) {
143
+ result = result.parent_path ();
144
+ continue ;
145
+ }
146
+ result /= component;
147
+ }
148
+ return result;
149
+ }
150
+
135
151
std::string Config::parseArgs (int argc, char **argv)
136
152
{
137
153
(void ) argc;
@@ -177,6 +193,9 @@ std::string Config::parseArgs(int argc, char **argv)
177
193
if (!m_projectFilePath.empty () && m_projectFilePath.is_relative ())
178
194
m_projectFilePath = m_configPath.parent_path () / m_projectFilePath;
179
195
196
+ if (m_filename.is_relative ())
197
+ m_filename = normalizePath (std::filesystem::current_path () / m_filename);
198
+
180
199
return " " ;
181
200
}
182
201
You can’t perform that action at this time.
0 commit comments