Skip to content

Commit

Permalink
Don't recursively create output directories and remember files to cle…
Browse files Browse the repository at this point in the history
…an up, fix #3322
  • Loading branch information
PHPirates committed Nov 22, 2023
1 parent c0e5225 commit 7906d27
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<html>
<body>
The command was not found in LaTeX or any included package.
This inspection is still experimental and a work in progress, so may have (many) false positives.
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ open class LatexCommandLineState(environment: ExecutionEnvironment, private val
else {
setOf()
}
runConfig.filesToCleanUpIfEmpty.addAll(createdOutputDirectories)

val handler = createHandler(mainFile, compiler)
val isMakeindexNeeded = runMakeindexIfNeeded(handler, mainFile, runConfig.filesToCleanUp)
Expand All @@ -77,7 +78,7 @@ open class LatexCommandLineState(environment: ExecutionEnvironment, private val
if (!isLastCompile(isMakeindexNeeded, handler)) return handler
scheduleBibtexRunIfNeeded(handler)
schedulePdfViewerIfNeeded(handler)
scheduleFileCleanup(runConfig.filesToCleanUp, createdOutputDirectories, handler)
scheduleFileCleanup(runConfig.filesToCleanUp, runConfig.filesToCleanUpIfEmpty, handler)

return handler
}
Expand Down
2 changes: 2 additions & 0 deletions src/nl/hannahsten/texifyidea/run/latex/LatexOutputPath.kt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class LatexOutputPath(private val variant: String, var contentRoot: VirtualFile?

// Create output paths (see issue #70 on GitHub)
files.asSequence()
// Ignore all output directories to avoid exponential recursion
.filter { !it.path.contains(outPath) }
.mapNotNull {
FileUtil.pathRelativeTo(includeRoot?.path ?: return@mapNotNull null, it.path)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ class LatexRunConfiguration(
// In order to propagate information about which files need to be cleaned up at the end between one run of the run config
// (for example makeindex) and the last run, we save this information temporarily here while the run configuration is running.
val filesToCleanUp = mutableListOf<File>()
val filesToCleanUpIfEmpty = mutableSetOf<File>()

override fun getConfigurationEditor(): SettingsEditor<out RunConfiguration> {
return LatexSettingsEditor(project)
Expand Down

0 comments on commit 7906d27

Please sign in to comment.