fix: handle when dir might be a file path

This commit is contained in:
Big Boss 2024-11-29 14:27:05 -06:00
parent 1672d9f864
commit e43d3bda6a
No known key found for this signature in database

View file

@ -435,8 +435,10 @@ class IdeProtocolClient(
"getRepoName" -> {
// Get the current repository name
val dir = (data as Map<String, Any>)["dir"] as String
val directory = File(dir)
val targetDir = if (directory.isFile) directory.parentFile else directory
val builder = ProcessBuilder("git", "config", "--get", "remote.origin.url")
builder.directory(File(dir))
builder.directory(targetDir)
var output = "NONE"
try {
val process = builder.start()