Warning - IntelliJ/Haxe while setting up OpenFL attempted (and partially succeeded) to delete my host (C) drive

Well. This nightmare just happened to me. I was happily working on setting up an OpenFL project via IntelliJ and Haxe. I hit “run”. Then I remember some console saying OpenFL is “initializing the project”. Then suddenly my CPU started working very very hard. Then some files went missing in the editor. Then dropbox started to complain. And the I switched to Total Commander and noticed that my C drive is suddenly quite… clean. Oh, and that a Main.hx file was located directly in C:. Nothing short of a nightmare scenario. Fortunately I have pretty good backup strategies. I still lost hours in setup work.

I’m posting this both here and on the Haxe community and I’m notifying the maker of the IntelliJ Haxe Plugin. Something seriously rotten happened here. I don’t have the courage to reboot my system. Will actually try this again just to see when this happens. Damn…

After a bit more digging, I realized where I lost about 13 GB: I think it deleted EVERYTHING on C drive until encountering a running program, located in a directory with the letter P, fortunately BEFORE Program Files. This also included the directory G for Games :D. I guess OpenFL/Haxe/IntelliJ wants me to give up gaming? Anyway, this is really no laughing matter.

I intend to carry on the ritual suicide of my C drive again, this time placing a “stop here” running program somewhere earlier. My development files were located in a directory with the letter D (Dropbox). I intend to save all the console logs I can and I’ll report back.

Sounds like it might be related to this bug in the IntelliJ plugin?

Hey. I went through the procedure again, this time nothing happened. I’m almost sorry, because I could have caught some really nasty issue. Anyway, I’m not touching this toolchain in this setup again :). Once was enough.

This wasn’t the home directory. It was THE ENTIRE C DRIVE, starting with the root.

What I believe is the issue is that there is some cleanup operation that wanted to happen. And then one of the involved tools forgot some relative path marker, or some tool broke down and proceeded to treat C drive as the project’s root. When that happened, boom, boom, boom off went all my directories in alphabetical order. Since I have a SSD recovery is also almost non-existent.

Oh well… I just leave this here in case anybody else has the issue.

Still, there’s probably a good chance it’s the same underlying issue.

I checked our source code, in case IntelliJ is using the openfl create project ProjectName command to initialize.

It appears that our code does not delete directories, but will attempt to make the “ProjectName” directory, if does not exist. It will then copy the template files, but will not delete files if you run the command into an existing folder.

The OpenFL build process is also not destructive in this way, so I think this is only an IntelliJ issue

It’s definitely one of the strangest things that happened to me in 20 years of software engineering, I kid you not. I mean, imagine… you just sit there, fresh after a cup of mate, eager to take on the world and WHAMMMMMM no more HaxeTookit (and all the libs I had installed there), no more Dropbox, no more GoogleDrive, no more Downloads :D. Everything gone in a blink of an eye (and some CPU work). It’s good I had Total Commander installed in “Prog”, otherwise I’d be reinstalling my Windows now :smiley:.

You won’t read this often from me but DAMN am I happy for having my work in a Dropbox.

Anyway, I’m not pointing fingers. I just came to say what happened and I was IMMEDIATELY fully aware of the complexity of the problem. There are at least 4 major tools at work: IntelliJ, Haxe Plugin, Lime Command Line Tools, OpenFL to name a few.

Unfortunately I’m not willing to put time into testing this. I already lost a day of work over this.

Thank you for your attention! :slight_smile:

Hi!

I’m the IntelliJ-Haxe maintainer, so between Joshua (singmajesty – the OpenFL maintainer) and I, we should be able to figure this out.

My guess is that it wasn’t “Run->Run …”, but “Build->Rebuild Project…” that was the culprit. It wipes out whatever directory is set up as the project’s output directory “File->Project Structure…->Project (selection in left panel)->Project compiler output (text box)”. When selected, IntelliJ IDEA (and not the plugin) will wipe whatever directory is specified there. If it’s empty, it will usually select IntelliJ IDEA’s home directory and wipe out the IDEA installation. Sounds like somehow, the project was generated with that as “C:”.

How did you create the project? Using OpenFL’s tools, or using the project wizard in IntelliJ IDEA or some other tool?

-Eric

1 Like

Hey @EricBishton, nice to see you here :slight_smile: I wrote you recently on the topic of indents in your plugin :smiley:.

So, since you guys are so damn awesome, I went back with fresh energy to attack this problem. Luckily, I had the project files in Dropbox, so I could restore them after the delepocalypse. So, since I already have an e-mail conversation with you, Eric, I will send you the entire project directory. It’s not large since it’s just a test project.

To answer your question, I generated the project using openfl tools (openfl create) which I executed in the command prompt in the folder c:\Dropbox (MyDropboxUser)\directory\directory\directory\ClientFlash\

I followed this tutorial about setting up OpenFL:

Also, I’d like to emphasize that the second time I ran this, IT WORKED. I had placed “guardian” running executables all over the place but nothing was deleted anyway. It only happened when first setting up the project. And yes, I know the IJ behavior of deleting some output folder. But this is absolutely insane when it comes to a folder which is way above the project folder. With all due respect to the awesome people coding IJ, as an engineer, I’d put some serious warnings before daring to delete any folder above the project’s and particularly folders in the damn root :smiley:

Yep, looking at the project files, the compiler output directory was set to the C: drive: <output url="file://C:/" />

Now, to figure out how it got set that way

Holy macaroni :slight_smile:. So it was still there. Wow, I feel like my suffering was not in vain, haha. It’s curious that the second time it didn’t attempt to delete anything. But from what I can remember, IJ only does the “crazy delete” the first time you build (without even warning you or asking you if you’d like to clean your build folder and with this setting “on by default”). I lost files in my build directory like this on other occasions as well, but this was by far, and understandable, the worst I ever experienced.

Anyway, I can assure you I didn’t set the output location to C:. I also didn’t interfere with any paths, I was following a tutorial and that’s it. From what I remember, all my module locations were set to quite long paths inside my dropbox. BTW if you paste anything in the future I’d appreciate hiding my dropbox user.

Could it have any connection with the fact that I have spaces inside the path? The very first directory is Dropbox (MyUsername), including space and parenthesis.

My gut feeling, however, says that this might have to do with some sort of path generation script. Perhaps some bug squeezed in via the command line tools used by OpenFL?

My default IJ settings for new projects are also far inside my Dropbox and it always keeps them. Never had to edit anything other than the last name in the path. I’m touch-typing so I notice when I mess up paths or the like.