-
Notifications
You must be signed in to change notification settings - Fork 70
Fix the Windows platform implementation of the FileSystem API #470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
Another bug exists, for the long path handling. I will fix it in another PR. |
|
@iseki0 thanks for opening the PR! Is it possible to add tests reproducing issues that might occur when using mingw's opendir/readdir (and SomethingSomethingA Win32 functions)? |
build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts
Show resolved
Hide resolved
I will have a try, the simpliest way is add some file/folder with non-English filename. I will add it to mingw test directory. |
@fzhinkin |
When setup Windows with the default configuration(non-English version and, <=Windows 10). The |
|
Please do squash merging. And please add a co-author which2who@gmail.com, he also made a patch but he's late😂. He notice me that the basename/dirname... should be fixed too. |
|
Many testcases failed, because the Windows separator is '\' but the posix is '/'. The testcase compare the string directly... |
|
We shouldn't compare string directly. The path string shouldn't be comparing directly. It's platform dependent. |
|
OK, I fixed the SystemPathSeparator val... Now all test passed. |
115c841 to
4d7d065
Compare
|
@fzhinkin Now, I rebased, please review it again. At least it fix the encoding problem, on Windows |
I will need an explicit consent from that person for that.
Unfortunately, there are a few test failures: https://teamcity.jetbrains.com/buildConfiguration/KotlinTools_KotlinxIo_BuildAggregated/5556685?buildTab=tests&status=failed |
@Test
fun testA(){
memScoped {
println(dirname("C:\\foo\\bar".cstr)!!.toKString())
println(dirname("C:\\foo\\bar".cstr)!!.toKStringFromUtf8())
println(dirname("C:\\啊啊啊啊\\123".cstr)!!.toKString())
println(dirname("C:\\啊啊啊啊\\123".cstr)!!.toKStringFromUtf8())
println(dirname("C:\\irohauta\\いろはにほへと\\ちりぬるを".cstr)!!.toKString())
println(dirname("C:\\irohauta\\いろはにほへと\\ちりぬるを".cstr)!!.toKStringFromUtf8())
}
}output My Windows: Default code page: 936, GBK |
|
I add a skip to the TeamCity test |
|
I think the Windows path handling still have many problems, after this PR. This only fix the encoding problem and make it basiclly available, on Windows platform. So we'd better merge it quickly. Because after that we'd better to begin to consider the following problems:
Any, maybe many others... |
Problem
Memo
The Windows path related string should be accessed by Win32 API which with
Wsuffix, don't useAsuffix API or you will get trouble on non-English content. By mingw is also unrecommended, they always get trouble on encoding handling. So, just use the plain Win32 API, the most eaist choice.And...
I refactor your project layout, remove the
nativeNonAndroidsourceset. (The dir list code is the only code in this sourceset.)I don't think seperate the world be
xxandnonXxis a good choice. Now we need the third part......If I make something wrong, let me know.