@@ -53,7 +53,7 @@ class OdooLSInstallationProjectActivity : ProjectActivity, DumbAware {
5353 }
5454
5555 fun copyDirectoryFromResourcesToInstallLocation (directoryPath : String , targetPath : String ) {
56- val targetLocation = Paths .get(targetPath, " typeshed " )
56+ val targetLocation = Paths .get(targetPath, directoryPath )
5757 val resourceUrl = javaClass.classLoader.getResource(directoryPath)
5858 ? : throw IllegalArgumentException (" Resource not found: $directoryPath " )
5959
@@ -82,7 +82,7 @@ class OdooLSInstallationProjectActivity : ProjectActivity, DumbAware {
8282 }
8383 }
8484
85- fun ressourceToInstallPath (resourcePath : String , targetPath : Path ) {
85+ fun resourceToInstallPath (resourcePath : String , targetPath : Path ) {
8686 javaClass.classLoader.getResourceAsStream(resourcePath).use { input ->
8787 requireNotNull(input) { " Resource not found: $resourcePath " }
8888 try {
@@ -192,23 +192,31 @@ class OdooLSInstallationProjectActivity : ProjectActivity, DumbAware {
192192
193193 installedVersionOlder(Paths .get(targetLocation, exeName)) { isOlder ->
194194 if (isOlder) {
195- ressourceToInstallPath (" odools-binaries/${targetOs} /$exeName " , Paths .get(targetLocation, exeName))
195+ resourceToInstallPath (" odools-binaries/${targetOs} /$exeName " , Paths .get(targetLocation, exeName))
196196
197197 if (SystemInfo .isWindows &&
198198 (! Files .exists(Paths .get(targetLocation, " odoo_ls_server.pdb" )))) {
199- ressourceToInstallPath (" odools-binaries/${targetOs} /odoo_ls_server.pdb" , Paths .get(targetLocation, " odoo_ls_server.pdb" ))
199+ resourceToInstallPath (" odools-binaries/${targetOs} /odoo_ls_server.pdb" , Paths .get(targetLocation, " odoo_ls_server.pdb" ))
200200 }
201201 if (! SystemInfo .isWindows) {
202202 Paths .get(targetLocation, exeName).toFile().setExecutable(true , false )
203203 }
204204 }
205- if (! Files .exists(Paths .get(targetLocation, " typeshed" )) && isTypeshedOutDated(Paths .get(targetLocation, " typeshed" ))) {
205+ if (! Files .exists(Paths .get(targetLocation, " typeshed" )) || isTypeshedOutDated(Paths .get(targetLocation, " typeshed" ))) {
206206 val file = Paths .get(targetLocation, " typeshed" ).toFile()
207207 if (file.exists()) {
208208 file.deleteRecursively()
209209 }
210210 copyDirectoryFromResourcesToInstallLocation(" typeshed" , targetLocation)
211211 }
212+ if (! Files .exists(Paths .get(targetLocation, " additional_stubs" ))) {
213+ val file = Paths .get(targetLocation, " additional_stubs" ).toFile()
214+ if (file.exists()) {
215+ file.deleteRecursively()
216+ }
217+ copyDirectoryFromResourcesToInstallLocation(" additional_stubs" , targetLocation)
218+
219+ }
212220 println (" Installation complete" )
213221 callback()
214222 }
0 commit comments