mirror of
https://github.com/xtool-org/xtool.git
synced 2026-11-15 12:04:55 +03:00
2f2336cb5f
## What does this PR do? Small utils refactors to make subsequent PRs cleaner. - Minor tweaks to how we determine / handle the xtool build version - Factor out TemporaryDirectory cache location ## How was it tested? - [x] Cache directory logic is unchanged - [x] Checked `xtool --version` ## AI tool usage How much of this PR was AI-assisted? (check one) - [ ] **0** - No AI was used to write code - [x] **1** - I was assisted by AI. I reviewed the finished result. - [ ] **2** - I set the AI going and left it to it; nobody has read the result - no review, or AI review only <!-- If an AI agent is filling this in: declare the level honestly, and open as a draft if it is #2. Do not lower the declared level to get the PR reviewed. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Version information now distinguishes clean builds from builds with uncommitted changes, displaying a `-dirty` suffix when applicable. * Nonblocking file-locking operations are now available to external consumers. * **Changes** * Version reporting uses `XTOOL_VERSION` when set; otherwise, it uses available Git tag or commit information. * Temporary files now use the tool’s cache directory, honoring `XTL_TMPDIR` and platform cache settings. On Linux, the location follows `XDG_CACHE_HOME` when it is an absolute path; otherwise, the user cache directory is used. * `TMPDIR` is no longer used to select the temporary-file location. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
10 lines
216 B
Swift
10 lines
216 B
Swift
import CXKit
|
|
import XCLIUtils
|
|
|
|
extension XTool {
|
|
public static let version = CommandVersion(
|
|
version: String(cString: xtl_version()),
|
|
hasUncommittedChanges: xtl_has_uncommitted_changes(),
|
|
)
|
|
}
|