diff --git a/bin/win/fsnotifier.exe b/bin/win/fsnotifier.exe index 21c8c95a3103..4c04fd603946 100644 Binary files a/bin/win/fsnotifier.exe and b/bin/win/fsnotifier.exe differ diff --git a/bin/win/fsnotifier64.exe b/bin/win/fsnotifier64.exe index 5324b9a3715c..71ad2e277747 100644 Binary files a/bin/win/fsnotifier64.exe and b/bin/win/fsnotifier64.exe differ diff --git a/native/fileWatcher/fileWatcher3.cpp b/native/fileWatcher/fileWatcher3.cpp index 358298ff286a..3c757b94285b 100644 --- a/native/fileWatcher/fileWatcher3.cpp +++ b/native/fileWatcher/fileWatcher3.cpp @@ -260,9 +260,6 @@ void PrintWatchRootReparsePoints() { // -- Watcher thread ---------------------------------------------------------- void PrintChangeInfo(char *rootPath, FILE_NOTIFY_INFORMATION *info) { - char FileNameBuffer[_MAX_PATH]; - int converted = WideCharToMultiByte(CP_ACP, 0, info->FileName, info->FileNameLength / sizeof(WCHAR), FileNameBuffer, _MAX_PATH - 1, NULL, NULL); - FileNameBuffer[converted] = '\0'; char *command; if (info->Action == FILE_ACTION_ADDED || info->Action == FILE_ACTION_RENAMED_OLD_NAME) { command = "CREATE"; @@ -277,6 +274,10 @@ void PrintChangeInfo(char *rootPath, FILE_NOTIFY_INFORMATION *info) { return; // unknown command } + char FileNameBuffer[2*_MAX_PATH + 1]; + int converted = WideCharToMultiByte(CP_UTF8, 0, info->FileName, info->FileNameLength / sizeof(WCHAR), FileNameBuffer, 2*_MAX_PATH, NULL, NULL); + FileNameBuffer[converted] = '\0'; + EnterCriticalSection(&csOutput); puts(command); printf("%s", rootPath); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java index 86259b45de35..7787d71a3781 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.ShutDownTracker; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.local.FileWatcherNotificationSink; @@ -290,7 +291,7 @@ public class NativeFileWatcherImpl extends PluggableFileWatcher { @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") private MyProcessHandler(@NotNull Process process, @NotNull String commandLine) { - super(process, commandLine, null); // do not access EncodingManager here + super(process, commandLine, SystemInfo.isWindows ? CharsetToolkit.UTF8_CHARSET : null); // do not access EncodingManager here myWriter = new BufferedWriter(new OutputStreamWriter(process.getOutputStream())); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java index 2ef6dc5abc43..a103d88008e9 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,10 +53,12 @@ import static com.intellij.openapi.util.io.IoTestUtil.*; @SuppressWarnings("Duplicates") public class FileWatcherTest extends PlatformTestCase { + private static final Logger LOG = Logger.getInstance(NativeFileWatcherImpl.class); + private static final int INTER_RESPONSE_DELAY = 500; // time to wait for a next event in a sequence private static final int NATIVE_PROCESS_DELAY = 60000; // time to wait for a native watcher response - private static final Logger LOG = Logger.getInstance(NativeFileWatcherImpl.class); + @SuppressWarnings("SpellCheckingInspection") private static final String UNICODE_NAME = "Юникоде-Úñíçødê.txt"; private FileWatcher myWatcher; private LocalFileSystem myFileSystem; @@ -772,14 +774,13 @@ public class FileWatcherTest extends PlatformTestCase { } public void testUnicodePaths() throws Exception { - if (!SystemInfo.isUnix || SystemInfo.isMac) { - System.err.println("Ignored: well-defined FS required"); + if (SystemInfo.isMac) { + System.err.println("Ignored: not yet supported"); return; } File topDir = createTestDir(myTempDirectory, "top"); - File testDir = createTestDir(topDir, "тест"); - File testFile = createTestFile(testDir, "файл.txt"); + File testFile = createTestFile(topDir, UNICODE_NAME); refresh(topDir); LocalFileSystem.WatchRequest request = watch(topDir);