mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
chore: stop listening if the file does not exist (#230)
This commit is contained in:
@@ -668,9 +668,15 @@ class FileSystemPanel(
|
||||
coroutineScope.launch(Dispatchers.IO) {
|
||||
while (coroutineScope.isActive) {
|
||||
try {
|
||||
|
||||
if (!Files.exists(localPath)) {
|
||||
break
|
||||
}
|
||||
|
||||
val nowModifiedTime = localPath.getLastModifiedTime().toMillis()
|
||||
if (nowModifiedTime != lastModifiedTime) {
|
||||
lastModifiedTime = nowModifiedTime
|
||||
withContext(Dispatchers.Swing) {
|
||||
// upload
|
||||
transportManager.addTransport(
|
||||
transport = FileTransport(
|
||||
@@ -682,12 +688,15 @@ class FileSystemPanel(
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
if (log.isErrorEnabled) {
|
||||
log.error(e.message, e)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
delay(250.milliseconds)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user