@@ -292,28 +292,28 @@ checkPath(
292
292
namespace fs = llvm::sys::fs;
293
293
namespace path = llvm::sys::path;
294
294
295
+ // See if inputPath references a file or directory
295
296
inputPath = files::normalizePath (inputPath);
297
+ auto fileType = files::getFileType (inputPath);
298
+ if (!fileType)
299
+ {
300
+ return report::error (" {}: \" {}\" " , fileType.error (), inputPath);
301
+ }
296
302
297
303
// Set the reference directories for the test
298
- dirs_.configDir = inputPath;
304
+ std::string const inputDir = fileType == files::FileType::directory
305
+ ? inputPath
306
+ : files::getParentDir (inputPath);
307
+ dirs_.configDir = inputDir;
299
308
dirs_.cwd = dirs_.configDir ;
300
309
301
- // See if inputPath references a file or directory
302
- auto fileType = files::getFileType (inputPath);
303
- if (! fileType)
304
- return report::error (" {}: \" {}\" " ,
305
- fileType.error (), inputPath);
306
-
307
310
// Check for a directory-wide config
308
311
Config::Settings dirSettings;
309
312
testArgs.apply (dirSettings, dirs_, argv);
310
313
dirSettings.multipage = false ;
311
314
dirSettings.sourceRoot = files::appendPath (inputPath, " ." );
312
- dirSettings.stdlibIncludes .insert (
313
- dirSettings.stdlibIncludes .end (),
314
- testArgs.stdlibIncludes .begin (),
315
- testArgs.stdlibIncludes .end ());
316
- std::string const & configPath = files::appendPath (inputPath, " mrdocs.yml" );
315
+
316
+ std::string const & configPath = files::appendPath (inputDir, " mrdocs.yml" );
317
317
if (files::exists (configPath)) {
318
318
Config::Settings::load_file (dirSettings, configPath, dirs_).value ();
319
319
if (auto exp = dirSettings.normalize (dirs_); !exp ) {
0 commit comments