-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
os: Create file issue in windows when filename contains ":"(colon) #8935
Labels
Milestone
Comments
I cannot reproduce your problem: C:\go\path\src\issue8935>dir a: The system cannot find the path specified. C:\go\path\src\issue8935>go version go version devel +f8a253b426f1 Thu Oct 16 09:13:50 2014 +1100 windows/386 C:\go\path\src\issue8935>type main.go package main import ( "fmt" "log" "os" ) func main() { f, err := os.Create("a:b.txt") if err != nil { log.Fatal(err) } defer f.Close() fmt.Printf("Hello\n") } C:\go\path\src\issue8935>go run main.go 2014/10/16 10:31:10 open a:b.txt: The system cannot find the path specified. exit status 1 Please, provide more details for me to reproduce your problem THank you. Alex Status changed to WaitingForReply. |
We use CreateFile Windows API to create files. And that is what happens when you request to create file named ab:c. The API succeeds, and you get ab file created in your current directory: C:\go\path\src\issue8935>dir ab Volume in drive C has no label. Volume Serial Number is XXXX-XXXX Directory of C:\go\path\src\issue8935 File Not Found C:\go\path\src\issue8935>go version go version devel +f8a253b426f1 Thu Oct 16 09:13:50 2014 +1100 windows/386 C:\go\path\src\issue8935>type main.go package main import ( "fmt" "log" "os" ) func main() { f, err := os.Create("ab:c") if err != nil { log.Fatal(err) } defer f.Close() fmt.Printf("Hello\n") } C:\go\path\src\issue8935>go run main.go Hello C:\go\path\src\issue8935>dir ab Volume in drive C has no label. Volume Serial Number is XXXX-XXXX Directory of C:\go\path\src\issue8935 16/10/2014 04:11 PM 0 ab 1 File(s) 0 bytes 0 Dir(s) 116,078,178,304 bytes free While I agree with you (I would expect the API to fail in this instance), I don't see another alternative, but to go with CreateFile behaviour. Perhaps you have better argument, but I am closing this issue for now. Alex Status changed to WorkingAsIntended. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: