@@ -13,7 +13,7 @@ import ee.carlrobert.codegpt.settings.service.ServiceType
13
13
import ee.carlrobert.codegpt.settings.service.codegpt.CodeGPTService
14
14
import ee.carlrobert.codegpt.toolwindow.chat.ui.textarea.AttachImageNotifier
15
15
import ee.carlrobert.codegpt.ui.OverlayUtil
16
- import io.ktor.util.*
16
+ import java.nio.file.Path
17
17
import java.nio.file.Paths
18
18
import kotlin.io.path.absolutePathString
19
19
@@ -34,7 +34,7 @@ class CodeGPTProjectActivity : ProjectActivity {
34
34
) {
35
35
val desktopPath = Paths .get(System .getProperty(" user.home" ), " Desktop" )
36
36
project.service<FileWatcher >().watch(desktopPath) {
37
- if (watchExtensions.contains(it.extension.lowercase( ))) {
37
+ if (watchExtensions.contains(getFileExtension(it ))) {
38
38
showImageAttachmentNotification(
39
39
project,
40
40
desktopPath.resolve(it).absolutePathString()
@@ -44,6 +44,16 @@ class CodeGPTProjectActivity : ProjectActivity {
44
44
}
45
45
}
46
46
47
+ private fun getFileExtension (path : Path ): String {
48
+ val fileName = path.fileName.toString()
49
+ val lastIndexOfDot = fileName.lastIndexOf(' .' )
50
+ return if (lastIndexOfDot != - 1 ) {
51
+ fileName.substring(lastIndexOfDot + 1 ).lowercase()
52
+ } else {
53
+ " "
54
+ }
55
+ }
56
+
47
57
private fun showImageAttachmentNotification (project : Project , filePath : String ) {
48
58
OverlayUtil .getDefaultNotification(
49
59
CodeGPTBundle .get(" imageAttachmentNotification.content" ),
0 commit comments