diff --git a/README.md b/README.md index 4d04d01e..498f6483 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ or from [Coder's Github Release page](https://github.com/coder/coder-jetbrains-t The next step is to copy the zip content to one of the following locations, depending on your OS: -* Windows: `%LocalAppData%/JetBrains/Toolbox/plugins/com.coder.toolbox` +* Windows: `%LocalAppData%/JetBrains/Toolbox/cache/plugins/com.coder.toolbox` * macOS: `~/Library/Caches/JetBrains/Toolbox/plugins/com.coder.toolbox` * Linux: `~/.local/share/JetBrains/Toolbox/plugins/com.coder.toolbox` diff --git a/buildSrc/src/main/kotlin/PluginUtils.kt b/buildSrc/src/main/kotlin/PluginUtils.kt index 49ae7891..785872d9 100644 --- a/buildSrc/src/main/kotlin/PluginUtils.kt +++ b/buildSrc/src/main/kotlin/PluginUtils.kt @@ -8,16 +8,29 @@ import kotlin.io.path.div * Resolves the Toolbox plugin install directory for the current OS. */ fun getPluginInstallDir(extensionId: String): Path { - val userHome = System.getProperty("user.home").let { Path.of(it) } - val pluginsDir = when (OS.current()) { - OS.WINDOWS -> System.getenv("LOCALAPPDATA")?.let { Path.of(it) } ?: (userHome / "AppData" / "Local") - // currently this is the location that TBA uses on Linux - OS.LINUX -> System.getenv("XDG_DATA_HOME")?.let { Path.of(it) } ?: (userHome / ".local" / "share") - OS.MAC -> userHome / "Library" / "Caches" + val userHome = Path.of(System.getProperty("user.home")) + val toolboxDir = when (OS.current()) { + OS.WINDOWS -> { + val localAppData = System.getenv("LOCALAPPDATA") + ?.takeIf { it.isNotBlank() } + ?.let { Path.of(it) } + ?: (userHome / "AppData" / "Local") + localAppData / "JetBrains" / "Toolbox" / "cache" + } + + OS.LINUX -> { + val dataHome = System.getenv("XDG_DATA_HOME") + ?.takeIf { it.isNotBlank() } + ?.let { Path.of(it) } + ?: (userHome / ".local" / "share") + dataHome / "JetBrains" / "Toolbox" + } + + OS.MAC -> userHome / "Library" / "Caches" / "JetBrains" / "Toolbox" else -> error("Unknown os") - } / "JetBrains" / "Toolbox" / "plugins" + } - return pluginsDir / extensionId + return toolboxDir / "plugins" / extensionId } /** diff --git a/src/main/kotlin/com/coder/toolbox/feed/IdeFeedManager.kt b/src/main/kotlin/com/coder/toolbox/feed/IdeFeedManager.kt index 6cfcc80f..40381355 100644 --- a/src/main/kotlin/com/coder/toolbox/feed/IdeFeedManager.kt +++ b/src/main/kotlin/com/coder/toolbox/feed/IdeFeedManager.kt @@ -23,10 +23,10 @@ import kotlin.jvm.optionals.getOrNull * This manager handles fetching IDE information from JetBrains data services, * caching the results locally, and supporting offline mode. * - * Cache files are stored in platform-specific locations: - * - macOS: ~/Library/Application Support/JetBrains/Toolbox/plugins/com.coder.toolbox/ - * - Linux: ~/.local/share/JetBrains/Toolbox/plugins/com.coder.toolbox/ - * - Windows: %LOCALAPPDATA%/JetBrains/Toolbox/plugins/com.coder.toolbox/ + * Cache files are stored in the Coder Toolbox data directory: + * - macOS: ~/Library/Application Support/coder-toolbox/ + * - Linux: ${XDG_DATA_HOME:-~/.local/share}/coder-toolbox/ + * - Windows: %LOCALAPPDATA%/coder-toolbox/ */ class IdeFeedManager( private val context: CoderToolboxContext,