-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from devchat-ai/new-installation-process
New installation process
- Loading branch information
Showing
19 changed files
with
197 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "gui"] | ||
path = gui | ||
url = https://github.com/devchat-ai/devchat-gui.git | ||
[submodule "tools"] | ||
path = tools | ||
url = https://github.com/devchat-ai/devchat-vscode-tools.git |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package ai.devchat.common | ||
|
||
import java.util.* | ||
|
||
object OSInfo { | ||
val OS_NAME: String = System.getProperty("os.name").lowercase(Locale.getDefault()) | ||
val OS_ARCH: String = System.getProperty("os.arch") | ||
|
||
val isWindows: Boolean = OS_NAME.contains("win") | ||
val platform: String = when { | ||
OS_NAME.contains("win") -> | ||
if (OS_ARCH.contains("64")) "win-64" | ||
else throw RuntimeException("Unsupported architecture: $OS_ARCH") | ||
|
||
OS_NAME.contains("darwin") || OS_NAME.contains("mac") -> when { | ||
OS_ARCH.contains("arm") -> "osx-arm64" | ||
OS_ARCH.contains("64") -> "osx-64" | ||
else -> throw RuntimeException("Unsupported architecture: $OS_ARCH") | ||
} | ||
|
||
OS_NAME.contains("linux") -> when { | ||
OS_ARCH.contains("x64") -> "linux-64" | ||
OS_ARCH.contains("ppc64le") -> "linux-ppc64le" | ||
OS_ARCH.contains("aarch64") -> "linux-aarch64" | ||
else -> throw RuntimeException("Unsupported architecture: $OS_ARCH") | ||
} | ||
|
||
else -> throw RuntimeException("Unsupported operating system: $OS_NAME") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package ai.devchat.common | ||
|
||
import java.io.IOException | ||
import java.nio.file.* | ||
import java.nio.file.attribute.BasicFileAttributes | ||
|
||
object PathUtils { | ||
val workPath: String = Paths.get(System.getProperty("user.home"), ".chat").toString() | ||
var pythonCommand: String = "python" | ||
val pythonPath: String = Paths.get(workPath, "site-packages").toString() | ||
|
||
fun copyResourceDirToPath(resourceDir: String, outputPath: String) { | ||
val uri = javaClass.getResource(resourceDir)!!.toURI() | ||
val path = if (uri.scheme == "jar") { | ||
val fileSystem = FileSystems.newFileSystem(uri, emptyMap<String, Any>()) | ||
fileSystem.getPath("/$resourceDir") | ||
} else { | ||
Paths.get(uri) | ||
} | ||
|
||
Files.walkFileTree(path, object : SimpleFileVisitor<Path>() { | ||
@Throws(IOException::class) | ||
override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult { | ||
val relativeDir = dir.toString().substring(path.toString().length) | ||
val targetPath = Paths.get(outputPath, relativeDir) | ||
return if (!Files.exists(targetPath)) { | ||
Files.createDirectory(targetPath) | ||
FileVisitResult.CONTINUE | ||
} else { | ||
if (relativeDir == "") FileVisitResult.CONTINUE else FileVisitResult.SKIP_SUBTREE | ||
} | ||
} | ||
|
||
@Throws(IOException::class) | ||
override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult { | ||
val relativePath = file.toString().substring(path.toString().length) | ||
val targetFilePath = Paths.get(outputPath, relativePath) | ||
if (!Files.exists(targetFilePath)) { | ||
Files.copy(file, targetFilePath) | ||
} | ||
return FileVisitResult.CONTINUE | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.