================ @@ -186,19 +196,36 @@ Example usage for a project using a compile commands database: std::string ClangDocPath = GetExecutablePath(argv[0], MainAddr); llvm::SmallString<128> NativeClangDocPath; llvm::sys::path::native(ClangDocPath, NativeClangDocPath); - llvm::SmallString<128> AssetsPath; - AssetsPath = llvm::sys::path::parent_path(NativeClangDocPath); - llvm::sys::path::append(AssetsPath, "..", "share", "clang"); - llvm::SmallString<128> DefaultStylesheet; - llvm::sys::path::native(AssetsPath, DefaultStylesheet); - llvm::sys::path::append(DefaultStylesheet, - "clang-doc-default-stylesheet.css"); - llvm::SmallString<128> IndexJS; - llvm::sys::path::native(AssetsPath, IndexJS); - llvm::sys::path::append(IndexJS, "index.js"); - CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(), - std::string(DefaultStylesheet)); - CDCtx.FilesToCopy.emplace_back(IndexJS.str()); + if (!UserAssetPath.empty()) { + std::error_code code; + llvm::sys::fs::directory_iterator dirIt(std::string(UserAssetPath), code); + while (!code && dirIt != llvm::sys::fs::directory_iterator()) { ---------------- ilovepi wrote:
I'm not sure the logic here is correct. You check the error code, but what happens if that directory doesn't exist? To me it looks like the AssetsPath is never configured. https://github.com/llvm/llvm-project/pull/93928 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits