Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
e369a6b2
Commit
e369a6b2
authored
7 years ago
by
Dmitry Trofimov
Browse files
Options
Download
Email Patches
Plain Diff
Copy prebuilt indices to the writable index folder (PY-26075)
parent
131c0d5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/src/com/jetbrains/python/psi/impl/stubs/PyPrebuiltStubsProvider.java
+13
-0
...brains/python/psi/impl/stubs/PyPrebuiltStubsProvider.java
with
13 additions
and
0 deletions
+13
-0
python/src/com/jetbrains/python/psi/impl/stubs/PyPrebuiltStubsProvider.java
+
13
-
0
View file @
e369a6b2
...
...
@@ -24,6 +24,7 @@ import com.intellij.openapi.util.Disposer;
import
com.intellij.openapi.util.io.FileUtil
;
import
com.intellij.psi.stubs.*
;
import
com.intellij.util.indexing.FileContent
;
import
com.intellij.util.indexing.IndexInfrastructure
;
import
com.intellij.util.io.PersistentHashMap
;
import
com.jetbrains.python.psi.PyFileElementType
;
import
org.jetbrains.annotations.NotNull
;
...
...
@@ -55,6 +56,10 @@ public class PyPrebuiltStubsProvider implements PrebuiltStubsProvider, Disposabl
File
indexesRoot
=
findPrebuiltIndexesRoot
();
try
{
if
(
indexesRoot
!=
null
)
{
// we should copy prebuilt indexes to a writable folder
indexesRoot
=
copyPrebuiltIndexesToIndexRoot
(
indexesRoot
);
// otherwise we can get access denied error, because persistent hash map opens file for read and write
String
stubVersion
=
FileUtil
.
loadFile
(
new
File
(
indexesRoot
,
SDK_STUBS_STORAGE_NAME
+
".version"
));
int
currentVersion
=
PyFileElementType
.
INSTANCE
.
getStubVersion
();
...
...
@@ -86,6 +91,14 @@ public class PyPrebuiltStubsProvider implements PrebuiltStubsProvider, Disposabl
}
}
private
static
File
copyPrebuiltIndexesToIndexRoot
(
File
prebuiltIndicesRoot
)
throws
IOException
{
File
indexRoot
=
new
File
(
IndexInfrastructure
.
getPersistentIndexRoot
(),
"prebuilt"
);
FileUtil
.
copyDir
(
prebuiltIndicesRoot
,
indexRoot
);
return
indexRoot
;
}
@Nullable
@Override
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help