6 ms·
This thread confuses me, possibly because I'm not a UWP dev. OP keeps talking about the FileSavePicker being defective, but isn't that just a control? Isn't t
by mtVessel 4y ago
This thread confuses me, possibly because I'm not a UWP dev. OP keeps talking about the FileSavePicker being defective, but isn't that just a control? Isn't the actual writing being done by the FileIO classes? And doesn't it just boil down to someone using them wrong?
In the System.IO namespace we can explicitly specify a FileMode to indicate whether we're appending or overwriting. If the UWP equivalent doesn't exist (and you need to explicitly set the file length to 0 to truncate), why would anyone just assume it does one or the other?
"The API is crap" is still not an excuse for using it wrong. Am I missing something?
- mvandermeulen 4y agoI was also wondering along the same lines as an everything except for windows developer so it’s not just you. It would be good if someone could clarify.
- muststopmyths 4y agoyeah it's horseshit. The picker just let's you pick a file path. The Win32 API also requires you to specify that you want to truncate the existing files. How the fuck else would it work ? An additional OpenFileButTruncateExisting() API ? A SaveFileAndOverwriteExisting() API ? You can argue for those, but this thread is idiotic. He tries to furiously backpedal towards the end, but if he doesn't know the difference between a picker dialog and actually writing a file, I am not sure why I'd pay him any attention.
- Arnavion 4y agoNot only is the API called `FileSavePicker.PickSaveFileAsync` which any reasonable person would assume would give you a truncated file, but even Microsoft agrees that it should give you a truncated file. https://news.ycombinator.com/item?id=35277561 https://news.ycombinator.com/item?id=35277561
- JonChesterfield 4y ago`FileSavePicker.PickSaveFileAsync` manages to be redundant and ambiguous at the same time. Definitely wouldn't want to guess what that might do.
- mtVessel 4y agoSorry, my "reasonable" interpretation of the name tells me that it's a method to choose the file you want to save. It suggests absolutely nothing about actually writing data.
- Arnavion 4y agoNow continue reading the rest of the sentence.
- muststopmyths 4y agoyou are right. so it is the savefileandoverwriteexisting() api, with a bug. I stand corrected.