UABEA icon indicating copy to clipboard operation
UABEA copied to clipboard

Save overwrite doesn't check if other processes lock the file for modification

Open theman12222 opened this issue 2 years ago • 12 comments

Whenever i try saving a file, it saves to around 300 kilobytes then the Message box says There was a problem while writing the file: System.ObjectDisposedException: Cannot access a closed Stream. at System.IO.Strategies.BufferedFileStreamStrategy.Seek(Int64 offset, SeekOrigin origin) at System.IO.FileStream.set_Position(Int64 value) at AssetsTools.NET.AssetsFileReader.set_Position(Int64 value) at AssetsTools.NET.AssetsFile.Write(AssetsFileWriter writer, Int64 filePos, List`1 replacers, ClassDatabaseFile typeMeta) at UABEAvalonia.InfoWindow.SaveFile(Boolean saveAs) in D:\a\UABEA\UABEA\UABEAvalonia\InfoWindow.axaml.cs:line 576 If it helps i'm attempting to edit one of the textures for yandere simulator, but it loads the files just fine so i don't see why it shouldn't be able to save them. Please help. sorry the video is low quality

https://github.com/nesrak1/UABEA/assets/112595465/7fa70b38-f010-43cb-86ec-1c324c2d0358

theman12222 avatar Jul 18 '23 04:07 theman12222

I can't tell because the recording is so low res, but is this a bundle or assets file you opened? (Looks like assets file but not sure.) Did you close the starting window? I only see a preview of the asset info window open.

nesrak1 avatar Jul 18 '23 04:07 nesrak1

I have a higher quality recording. It's an asset file, i didn't close the starting window.

https://github.com/nesrak1/UABEA/assets/112595465/d3b146df-b9c7-444c-a8f2-e0078b9afd71

theman12222 avatar Jul 18 '23 04:07 theman12222

You've tried restarting and this still happens? Can you list the steps you did?

nesrak1 avatar Jul 18 '23 04:07 nesrak1

Yes, i've restarted and it still does it. I open a sharedassets file, edit one of the textures, then attempt to save it and every time it does that. I tried installing the nightly version before opening this and it still did the same thing

theman12222 avatar Jul 18 '23 04:07 theman12222

Are you using save or save as initially?

I'm trying to reproduce this with save and save as, even with the files being in a separate folder like in the video, but I can't get that closed stream error.

nesrak1 avatar Jul 18 '23 04:07 nesrak1

I tried save initially but then it just said There was a problem while writing the file: System.IO.IOException: The process cannot access the file 'C:\Users\Pcadm\Downloads\latest\YandereSimulator_Data\resources.assets' because it is being used by another process. at System.IO.FileSystem.DeleteFile(String fullPath) at System.IO.File.Delete(String path) at UABEAvalonia.InfoWindow.SaveFile(Boolean saveAs) in D:\a\UABEA\UABEA\UABEAvalonia\Forms\InfoWindow.axaml.cs:line 587

theman12222 avatar Jul 18 '23 04:07 theman12222

The regular save option will try to delete and replace the file. It sounds like there's another program that has it open still. Sometimes if you delete it yourself it will say This file can't be deleted because it's still open in XXX, where XXX is hopefully the name of the program and not "another application".

nesrak1 avatar Jul 18 '23 04:07 nesrak1

Oh yeah i'm just dumb, i had AssetStudio open while i was trying to save it lol. Thanks

theman12222 avatar Jul 18 '23 04:07 theman12222

I'll still want to fix this so I'm reopening it.

nesrak1 avatar Jul 18 '23 05:07 nesrak1

Alright i gotchu

theman12222 avatar Jul 18 '23 05:07 theman12222

This issue was fixed already in https://github.com/nesrak1/UABEANext (has an error message when a program other than UABEA still has this file open), but I probably won't be back porting it to this version of UABEA.

nesrak1 avatar Aug 12 '24 23:08 nesrak1