Добавлено определение пути до git в зависимости от платформы.

This commit is contained in:
2025-10-27 14:45:30 +03:00
parent 22bdd7b87e
commit bdb9b2db00
3 changed files with 27 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ set ::configDefault "\[General\]
cfgModifyDate='' cfgModifyDate=''
searchCommand=/usr/bin/grep searchCommand=/usr/bin/grep
searchCommandOptions=-r -n -H searchCommandOptions=-r -n -H
gitCommand=/usr/bin/git gitCommand=
# must return a mime type of file # must return a mime type of file
fileTypeCommand=/usr/bin/file fileTypeCommand=/usr/bin/file
fileTypeCommandOptions=-i -b fileTypeCommandOptions=-i -b

View File

@@ -12,6 +12,28 @@
namespace eval Git { namespace eval Git {
variable gitCommand variable gitCommand
# Определим путь до команды git в зависимсти от платформы
proc CommandPathSetting {} {
global cfgVariables tcl_platform
if {$cfgVariables(gitCommand) == ""} {
if {$tcl_platform(platform) eq "windows"} {
set cmd {where git}
} else {
set cmd {which git}
}
if {[catch {exec {*}$cmd} git_path]} {
puts "Git не найден в системе"
set cfgVariables(gitCommand) "Git not found"
return
}
set git_path [string trim $git_path]
set first_path [lindex [split $git_path "\n"] 0]
# puts "Git найден: $first_path"
set cfgVariables(gitCommand) $first_path
}
}
proc GetConfig {option} { proc GetConfig {option} {
global activeProject cfgVariables global activeProject cfgVariables
set confOptions { set confOptions {

View File

@@ -112,6 +112,8 @@ puts "Setting the locale... [::msgcat::mclocale]"
source [file join $dir(lib) gui.tcl] source [file join $dir(lib) gui.tcl]
Git::CommandPathSetting
# Open the PATH if command line argument has been setting # Open the PATH if command line argument has been setting
if [info exists opened] { if [info exists opened] {
foreach path $opened { foreach path $opened {
@@ -147,3 +149,4 @@ if [info exists opened] {
} }
} }
} }