Did C2 destroy my project?

Get help using Construct 2

Post » Fri May 29, 2015 9:52 pm

What you should do is use the option, "Save As Single File..".

I moved my capx to my new computer, and it didn't work because the images were saved on my other computer at the %temp% folder.

I then saved my capx using the "Save As Single File.." option, and it works when I move it to my new computer.
B
4
Posts: 15
Reputation: 226

Post » Sun May 31, 2015 12:02 pm

R0J0hound wrote:Just curious if it would be feasible to have c2 extract capx files to another location other than the temp folder when editing? Or I wonder if there's a way to block them from being deleted while the project is open.

This problem comes up from time to time and I don't really know what to do about it. If you have a bunch of programs open and you wipe your temp folder, is it really surprising to then find out you wiped files that were actively in use by the currently open programs?

C2 stores a lot of project information in temp because changes shouldn't be saved to your project until you click "save". With .capx files, which are really an entire project folder in a zip, it extracts the entire project to temp and works with everything there until you click save, then it zips the whole temp folder again and overwrites your .capx file. This is essential: nobody wants their file on disk to be modified until they click "save".

I don't want to make it save anywhere else because the operating system "temp" folder is the correct place to put this. If you do something like open a .capx and then forcibly close C2 (or it crashes), its temp files are all left behind. These kinds of leftover files can accumulate for various reasons, and then you may want to legitimately clean them all up, which standard tools/OS functions can do - just I assumed you'd always do this without any programs actively open!

So it seems some people run these utilities while their projects are open in C2, and it goes ahead and wipes their currently open work in temp. I think C2 can lock the files to prevent other tools trying to delete them, but I never thought people would try to do this, so now there's all sorts of bits of code scattered all through the C2 codebase which accesses various parts of the project in temp. If I forget just one file, the project will still get corrupted by cleaning temp. So... don't clean temp when apps are using temp files?
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,228

Post » Sun May 31, 2015 2:41 pm

@Ashley Some programs could protect their files so you cannot delete them if the files are in use. Could this be done to C2 too?
B
11
S
1
Posts: 63
Reputation: 658

Post » Sun May 31, 2015 7:16 pm

@Ashley
You can't control what a user does outside of a program. Locking the files may help, but yeah, it's more of a user misunderstanding about the use of the temp folder.

@sorbias
Ashley answered that above you.
B
91
S
31
G
102
Posts: 5,232
Reputation: 67,250

Post » Sun May 31, 2015 7:50 pm

I got this error a month back or so, I'm not sure what caused it (might have been paint.NET or something, since they both used files with the same name I dunno). I got it to work by opening the .capx in winrar and added the missing file into the destination specified in the error, have you tried doing that?
B
20
S
8
G
4
Posts: 195
Reputation: 3,555

Post » Mon Jun 01, 2015 6:51 am

@R0J0hound you're right. Shame on me i was not reading carefully enough.

@eliasfrost, I will do that if i got something similar later. This time i know that the error came from %Temp%, because my file size should be something like 30mt, but it became more like 60kt after i accidentally deleted my files from Temp. Lol. ATM its just funny, because i already have almost fixed all damages from one little older backup file. Also because i needed to redo something, i learned few better ways to do some scripts i lost.

Thanks everyone who wanted to help me! :)
B
11
S
1
Posts: 63
Reputation: 658

Post » Mon Jun 01, 2015 10:16 am

Ashley is right and Rojo too. Because no one can predict how the user going to behave.
B
245
S
37
G
15
Posts: 1,940
Reputation: 40,089

Post » Tue Aug 18, 2015 6:36 am

Ashley wrote:
R0J0hound wrote:Just curious if it would be feasible to have c2 extract capx files to another location other than the temp folder when editing? Or I wonder if there's a way to block them from being deleted while the project is open.

This problem comes up from time to time and I don't really know what to do about it. If you have a bunch of programs open and you wipe your temp folder, is it really surprising to then find out you wiped files that were actively in use by the currently open programs?

C2 stores a lot of project information in temp because changes shouldn't be saved to your project until you click "save". With .capx files, which are really an entire project folder in a zip, it extracts the entire project to temp and works with everything there until you click save, then it zips the whole temp folder again and overwrites your .capx file. This is essential: nobody wants their file on disk to be modified until they click "save".

I don't want to make it save anywhere else because the operating system "temp" folder is the correct place to put this. If you do something like open a .capx and then forcibly close C2 (or it crashes), its temp files are all left behind. These kinds of leftover files can accumulate for various reasons, and then you may want to legitimately clean them all up, which standard tools/OS functions can do - just I assumed you'd always do this without any programs actively open!

So it seems some people run these utilities while their projects are open in C2, and it goes ahead and wipes their currently open work in temp. I think C2 can lock the files to prevent other tools trying to delete them, but I never thought people would try to do this, so now there's all sorts of bits of code scattered all through the C2 codebase which accesses various parts of the project in temp. If I forget just one file, the project will still get corrupted by cleaning temp. So... don't clean temp when apps are using temp files?



I'm having a problem where the temp files are being deleted randomly without me choosing to do so. I'm not sure why this is happening, but it is annoying when my project suddenly stops working and I find out all the files are missing. What should I do about this?
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Tue Aug 18, 2015 8:55 am

I never had this problem. Sounds like Virus attack but, I am not sure about that.
B
245
S
37
G
15
Posts: 1,940
Reputation: 40,089

Post » Tue Aug 18, 2015 10:03 am

@Prominent - it's probably not anything to do with C2, it's probably some other software on your PC.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,228

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: MadSpy and 6 guests