MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / uniqueFreePath

Method uniqueFreePath

ChatView/SessionFileRegistry.cpp:46–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46QString SessionFileRegistry::uniqueFreePath(const QString &desiredPath) const
47{
48 if (desiredPath.isEmpty() || !m_lockedPaths.contains(desiredPath)) {
49 return desiredPath;
50 }
51
52 const QFileInfo info(desiredPath);
53 const QString dir = info.path();
54 const QString base = info.completeBaseName();
55 const QString suffix = info.suffix();
56
57 for (int counter = 2;; ++counter) {
58 QString candidate = dir + '/' + base + '_' + QString::number(counter);
59 if (!suffix.isEmpty()) {
60 candidate += '.' + suffix;
61 }
62 if (!m_lockedPaths.contains(candidate)) {
63 return candidate;
64 }
65 }
66}
67
68} // namespace QodeAssist::Chat

Callers 3

dispatchSendMethod · 0.80
autosaveMethod · 0.80
handOffSessionMethod · 0.80

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected