ganeshh123 / gta5-cleaner

A tool to clean out mods from Grand Theft Auto 5 for online play, and restore them later.
https://app.gn3.sh/gta5-cleaner/
MIT License
39 stars 7 forks source link

Crashes when attempting to move specific files #1

Open beryube opened 2 years ago

beryube commented 2 years ago

Hello there, I just installed your gta5 root folder cleaner and when I wanted to "clean" the folder. The App would just close and not clean the folder. Hope you can help me, Thanks.

ganeshh123 commented 2 years ago

Could you try running the app from Command Prompt at show me what it says?

Menno02 commented 2 years ago

I experience the same problem. This is what happens:

  1. I open the gta5cleaner.exe
  2. I type "clean" and press enter
  3. It immediately closes the command prompt (so no error visible)
  4. One or two seconds after that, it moves a part of the files to /modstore

After that happened:

  1. I manually place the rest of the mod files in the /modstore
  2. It cleans/restores fine now

Then, after playing "cleaned": it still works as intended After playing "restored" (with mods): the same thing is happening again

Also, the first time I used the program (with "clean") in my modded GTA V directory, I also had to manually remove some files.

I hope the problem is clear to you. If not, feel free to ask.

Edit: these are all files/folders it doesn't move to /modstore: image

ganeshh123 commented 2 years ago

Could you open your GTA 5 folder in command prompt and then run the following command: gta5cleaner.exe then clean and then show me what it says?

Menno02 commented 2 years ago

Well, I would love to do that. But one problem: it works now. 🤔 Quite strange tho, it didn't work multiple times on multiple days. When I encounter it again, I will do what you asked.

Edit: checking it every day, but it still didn't happen. Still using your very useful program, so if I will ever encounter any problems, I'll let you know. It apparently solved itself or something.

Menno02 commented 1 year ago

I finally faced this issue once again. I did what you asked, and this was the response:

Your Choice : clean readline.js:1032 throw err; ^

Error: EPERM: operation not permitted, rename 'C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\ELS' -> 'C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\modstore\ELS' at Object.renameSync (fs.js:591:3) at files.forEach (C:\snapshot\app.js:40:24) at Array.forEach () at cleanMods (C:\snapshot\app.js:39:15) at terminal.question (C:\snapshot\app.js:85:9) at Interface._onLine (readline.js:288:5) at Interface._line (readline.js:638:8) at Interface._ttyWrite (readline.js:919:14) at ReadStream.onkeypress (readline.js:168:10) at ReadStream.emit

(events.js:182:13)

ganeshh123 commented 1 year ago

Thank you, looks like a permission error then, perhaps some other program is using the file so it's not allowed to be moved. Are you sure GTA 5 and any related programs were completely closed before you ran the script?

Menno02 commented 1 year ago

Good question. Maybe I can reproduce it this weekend. I will try to answer your question then, if I have any news.

ganeshh123 commented 1 year ago

Thank you! I don't really play GTA 5 anymore, if I made some changes would you be willing to test them out for me?

Menno02 commented 1 year ago

If that is easy to test for me, yes, sure.

ganeshh123 commented 1 year ago

Could you please share which mods you had installe?

Menno02 commented 1 year ago

image image image Does this help? Also some vehicle replacements and some mods in the main folder.

ganeshh123 commented 1 year ago

Thanks a lot for offering to help, could you try running this and trying to clean while GTA 5 is running with mods and see what it says? If it closes out immediately please run it from Command Prompt. gta5cleaner_dev.zip Sorry about the virus warning, it will be there until enough people download it.

Menno02 commented 1 year ago

Sadly, Windows indeed tells me about viruses. I can't easily work around that warning. Isn't it a good idea if you test that package for yourself? You could download the mods I have, if that helps.

ganeshh123 commented 1 year ago

I was hoping to avoid having to install GTA 5, LSPDFR and a bunch of plugins, but that's fair if you don't feel comfortable downloading it, I'll try and test it out myself

ganeshh123 commented 1 year ago

Fixed in #7

ganeshh123 commented 1 year ago

@Menno02 Could you kindly test with the latest version?

Menno02 commented 1 year ago

Yes, after your fix I quickly tried it but received an error when cleaning (the Plugins folder couldn't be moved). Wanted to dive deeper into it now.

Run as administrator didn't work and I closed the game as always, so I ended up moving Plugins manually. Now, I wanted to restore. Again, the Plugins folder had trouble and the solutions didn't work. Then I wanted to clean again and copy the error, but it worked. Restoring after that also.

I thought, maybe it's only giving errors the first time cleaning and restoring after closing the game. I started GTA V (with mods), closed, and indeed, cleaning gave this error:

{ Error: EPERM: operation not permitted, rename 'C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\Plugins' -> 'C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\modstore\Plugins' at Object.renameSync (fs.js:591:3) at files.forEach (C:\snapshot\app.js:44:28) at Array.forEach () at cleanMods (C:\snapshot\app.js:42:15) at terminal.question (C:\snapshot\app.js:156:13) at Interface._onLine (readline.js:288:5) at Interface._line (readline.js:638:8) at Interface._ttyWrite (readline.js:919:14) at ReadStream.onkeypress (readline.js:168:10) at ReadStream.emit (events.js:182:13) errno: -4048, syscall: 'rename', code: 'EPERM', path: 'C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\Plugins', dest: 'C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\modstore\Plugins' }

Restoring after that, however, didn't. Looks like cleaning emits errors only until you manually clean the Plugins folder. What I mean, is that cleaning and restoring without manually moving the Plugins folder gives an error every time with cleaning, but after manually moving (clean mode) the Plugins folder, that stops.

I think this is enough information and I hope I didn't make it too complicated. I tried my best testing different scenarios. xD

ganeshh123 commented 1 year ago

Thanks a lot for helping me out with this, could you try unchecking "Read Only" for your "plugins" folder and see if that makes a difference? image

Menno02 commented 1 year ago

Very annoying from Windows, but I can't change that setting. I tried https://appuals.com/how-to-fix-folder-keeps-reverting-to-read-only-on-windows-10/ but that didn't help me.

ganeshh123 commented 1 year ago

Hmm, I feel like Windows is preventing that folder from being touched for some reason.

image image image Does this help? Also some vehicle replacements and some mods in the main folder.

Is this the contents of your "plugins" folder?

Menno02 commented 1 year ago

Yes. The one with 3 folders and 4 files is the content of the Plugins folder and the other two screenshots are Plugins\LSPDFR.

Michael21107 commented 6 months ago

@ganeshh123 dont forget bout this lol

Michael21107 commented 5 months ago

@ganeshh123

ganeshh123 commented 5 months ago

@Michael21107 I don't know what's causing that, the newer version should handle crashes.

Michael21107 commented 5 months ago

yeah, just reminding