@@ -4,16 +4,15 @@ import com.coder.toolbox.CoderToolboxContext
44import com.coder.toolbox.plugin.PluginManager
55import com.coder.toolbox.sdk.CoderHttpClientBuilder
66import com.coder.toolbox.sdk.interceptors.Interceptors
7- import com.coder.toolbox.util.OS
87import com.coder.toolbox.util.ReloadableTlsContext
9- import com.coder.toolbox.util.getOS
108import com.squareup.moshi.Moshi
119import com.squareup.moshi.Types
1210import kotlinx.coroutines.Dispatchers
1311import kotlinx.coroutines.withContext
1412import retrofit2.Retrofit
1513import retrofit2.converter.moshi.MoshiConverterFactory
1614import java.nio.file.Path
15+ import java.nio.file.Paths
1716import kotlin.io.path.exists
1817import kotlin.io.path.readText
1918
@@ -131,43 +130,18 @@ class IdeFeedManager(
131130 return allIdes
132131 }
133132
134- /* *
135- * Get the platform-specific cache directory path.
136- */
137- private fun getCacheDirectory (): Path {
138- val os = getOS()
139- val userHome = System .getProperty(" user.home" )
140-
141- val basePath = when (os) {
142- OS .MAC -> Path .of(userHome, " Library" , " Application Support" )
143- OS .LINUX -> Path .of(userHome, " .local" , " share" )
144- OS .WINDOWS -> {
145- val localAppData = System .getenv(" LOCALAPPDATA" )
146- ? : Path .of(userHome, " AppData" , " Local" ).toString()
147- Path .of(localAppData)
148- }
149-
150- null -> {
151- context.logger.warn(" Unable to determine OS, using home directory for cache" )
152- Path .of(userHome, " .cache" )
153- }
154- }
155-
156- return basePath.resolve(" JetBrains/Toolbox/plugins/com.coder.toolbox" )
157- }
158-
159133 /* *
160134 * Get the path for the release feed cache file.
161135 */
162136 private fun getReleaseCachePath (): Path {
163- return getCacheDirectory().resolve( RELEASE_CACHE_FILE )
137+ return Paths .get(context.settingsStore.globalDataDirectory, RELEASE_CACHE_FILE )
164138 }
165139
166140 /* *
167141 * Get the path for the EAP feed cache file.
168142 */
169143 private fun getEapCachePath (): Path {
170- return getCacheDirectory().resolve( EAP_CACHE_FILE )
144+ return Paths .get(context.settingsStore.globalDataDirectory, EAP_CACHE_FILE )
171145 }
172146
173147 /* *
0 commit comments