diff options
author | Alexander Neundorf <neundorf@kde.org> | 2023-02-01 23:05:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-02-06 15:21:19 (GMT) |
commit | 9a7612d2d0889fc097d091e633e12914183ae23d (patch) | |
tree | 79d269ab4d53c8f8e5e8af0200324c3c835ee4a7 /Source/cmExtraKateGenerator.cxx | |
parent | 8a7aa2642bcc63b0434b1e5a212931cd96d27e31 (diff) | |
download | CMake-9a7612d2d0889fc097d091e633e12914183ae23d.zip CMake-9a7612d2d0889fc097d091e633e12914183ae23d.tar.gz CMake-9a7612d2d0889fc097d091e633e12914183ae23d.tar.bz2 |
Kate: make it possible to force a mode for the "files" entry
By default, kate will try to autodetect whether the project is
a svn or git checkout or not.
In case this does not give a satisfying result, the user can now
set CMAKE_KATE_FILES_MODE to the mode he wants.
Diffstat (limited to 'Source/cmExtraKateGenerator.cxx')
-rw-r--r-- | Source/cmExtraKateGenerator.cxx | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index eec43c4..5418fd3 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -220,14 +220,32 @@ void cmExtraKateGenerator::CreateDummyKateProjectFile( std::string cmExtraKateGenerator::GenerateFilesString( const cmLocalGenerator& lg) const { - std::string s = cmStrCat(lg.GetSourceDirectory(), "/.git"); - if (cmSystemTools::FileExists(s)) { - return "\"git\": 1 "; + const cmMakefile* mf = lg.GetMakefile(); + std::string mode = + cmSystemTools::UpperCase(mf->GetSafeDefinition("CMAKE_KATE_FILES_MODE")); + static const std::string gitString = "\"git\": 1 "; + static const std::string svnString = "\"svn\": 1 "; + + if (mode == "SVN") { + return svnString; } + if (mode == "GIT") { + return gitString; + } + + std::string s; - s = cmStrCat(lg.GetSourceDirectory(), "/.svn"); - if (cmSystemTools::FileExists(s)) { - return "\"svn\": 1 "; + // check for the VCS files except when "forced" to "FILES" mode: + if (mode != "LIST") { + s = cmStrCat(lg.GetSourceDirectory(), "/.git"); + if (cmSystemTools::FileExists(s)) { + return gitString; + } + + s = cmStrCat(lg.GetSourceDirectory(), "/.svn"); + if (cmSystemTools::FileExists(s)) { + return svnString; + } } s = cmStrCat(lg.GetSourceDirectory(), '/'); |