908 deleted my source code?

Idea said that my project directory was from an old version and had to be rebuilt. When i did a rebuid project it deleted all my source code. I'm guessing that I should not set my project directory to be the parent directory of my source? is that right? Should Idea have deleted my source code?

15 comments
Comment actions Permalink

I'm guessing that I should not set my project directory to be the parent

directory of my source? is that right?

Is this the same as
http://www.intellij.net/tracker/idea/viewSCR?publicId=14720 ?

Should Idea have deleted my source code?


No.


0
Comment actions Permalink

i think it might be the same. we have the following directory structure (which i did not set up)

c:\projectname = output dir
c:\projectname\src = source dir

it's been bugging me for a while so i guess now is the time to change it

0
Comment actions Permalink

The behaviour is correct.
There's a checkbox in CompilerSettings "Clear output directory on rebuild". Your output directory is the same as module contents, so
the whole contents is deleted.
To prevent undesired deletion of sources we are going to implement two things:
1) Uncheck the checkbox by default
2) If an of output directory intersects with a source directory, display a warning, that sources might be deleted.

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"

"charles decroes" <spam@decroes.com> wrote in message news:15457397.1061983654362.JavaMail.itn@is.intellij.net...

i think it might be the same. we have the following directory structure (which i did not set up)

>

c:\projectname = output dir
c:\projectname\src = source dir

>

it's been bugging me for a while so i guess now is the time to change it



0
Comment actions Permalink

The behaviour is correct.


Sorry to disagree, but the behaviour is definitely NOT correct - at most is
"as designed".

Idea should NEVER delete files under sourcepaths (apart from class files)
and should protect beginner/clueless users from this kind of mistakes.

Your output directory is the same as module contents, so
the whole contents is deleted.
To prevent undesired deletion of sources we are going to implement two

things:

1) Uncheck the checkbox by default
2) If an of output directory intersects with a source directory, display a

warning, that sources might be deleted.

Good, this is a step in the right direction.

I would go one step further: never enable the "clear output directory on
rebuild" in this case. The tooltip for the disabled icon should say: "Cannot
be enabled: there exists an interesection between sourcepaths and outptut
paths".

Any automatic source removal should be done by the user - either by using
ant tasks or by the program that will regenerate the sources - as I don't
see a reason for sources to be deleted unless there's a code/data generator
involved somewhere.


I repeat again: removing source code has too serious consequences for idea
to be allowed to do it.

This leads to errors like happened to Charles Decroes and Sergey Dmitriev:
idea deletes all the project source code.

Things/people that destroy their means of subsistence do not have a bright
future.

Just my .02

Carlos


0
Comment actions Permalink

+1

I agree the directory structure of our app is incorrect, but that is how it was when I got here and it will be a lot of work for me to fix it. I may go ahead and do it since I lost a good bit of work, but

Idea should not allow me to delete source code especially since this was going to delete ALL the source code for the given project.

0
Comment actions Permalink

Sorry to disagree, but the behaviour is definitely NOT correct - at most is
"as designed".

Idea should NEVER delete files under sourcepaths (apart from class files)
and should protect beginner/clueless users from this kind of mistakes.


From the user's side, this is the best. Even if the user made some
weird setting, its data should be preserved.

>>2) If an of output directory intersects with a source directory, display a
>> warning, that sources might be deleted.


Good, this is a step in the right direction.

I would go one step further: never enable the "clear output directory on
rebuild" in this case. The tooltip for the disabled icon should say: "Cannot
be enabled: there exists an interesection between sourcepaths and outptut
paths".


Carlos, this is the right direction, but I would not disable the
checkbox. IMHO it would be better to show an "input failure" dialog when
pressing OK, that notifies the user about the disallowed
source-path/output-path intersection and does not apply the changes
unless this "conflict" is solved.

Tom

0
Comment actions Permalink

Have to agree I'm afraid.

Deleting individual named files is one thing, but wiping out whole directories without any manual intervention from the user ...?

That's a design mistake.

0
Comment actions Permalink

Rayz wrote:

Have to agree I'm afraid.

Deleting individual named files is one thing, but wiping out whole
directories without any manual intervention from the user ...?

That's a design mistake.


I believe some users of Nero Recode recently had some problems
because after recoding a movie the program would ask whether to delete
everything in the temp folder. If you had set the temp folder to C:\ it
happily deleted everything on your entire hard drive.

0
Comment actions Permalink


"Carlos Costa e Silva" <carlos@keysoft.pt> wrote in message news:biiuhr$v1u$1@is.intellij.net...

The behaviour is correct.

>

Sorry to disagree, but the behaviour is definitely NOT correct - at most is
"as designed".

>

Well, by saying "correct" I meant that the behaviour was expected since the option was checked. If you like "as designed" better,
let it be so.
I also agree that sources must not be deleted and the IDE should do its best to prevent accidental deletion of sources. However,
there's no 100% guarantee that you won't loose any neccesary files: in order for the check to work, some directories should be
marked as "sources", otherwise the program does not "know" about it.

>

I would go one step further: never enable the "clear output directory on
rebuild" in this case. The tooltip for the disabled icon should say: "Cannot
be enabled: there exists an interesection between sourcepaths and outptut
paths".

>

I wouldn't perfor the check in the UI since this is not the only way to turn the option on (one might edit project files directly or
import them from the VCS). The safest way IMHO is to perform the check before the compilation. The reaction of the program is
discussable:
1) display the warning and don't compile
2) display the warning, do not delete anything, but compile
3) display the warning and if accepted, delete everything :)

Option (2) looks ok to me. What do you think?

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"


0
Comment actions Permalink

In my case I did have the directory marked as source. It's really my fault for not fixing the stupid directory structure. It was like that when I came and all the .bat and ant files will have to change.

0
Comment actions Permalink

I think this case will be handled by setting the option to "off" by default.

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"

"charles decroes" <spam@decroes.com> wrote in message news:729395.1062072620149.JavaMail.itn@is.intellij.net...

In my case I did have the directory marked as source. It's really my fault for not fixing the stupid directory structure. It was

like that when I came and all the .bat and ant files will have to change.


0
Comment actions Permalink

I think this case will be handled by setting the option to "off" by default.


... and prohibit a source folder within the output folder.

Tom


0
Comment actions Permalink

well nobody said that, i agree it's a bad idea but sometimes youc an help it. We have 8 pretty big apps here and they are all setup that way. So it will take me some time to get them all changed. I have to change all the start/stop scripts, ant files, check all the source code in, drop all my sandboxes and recreate them all. Then I'll have to go around to every other developers machine and fix it there also.

0
Comment actions Permalink

Ok, the next public EA build will have the option "off" by default as well as the warning message.

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"

"Eugene Zhuravlev (JetBrains)" <jeka@intellij.com> wrote in message news:biksrd$qvo$1@is.intellij.net...

I think this case will be handled by setting the option to "off" by default.

>

--

>

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"

>

"charles decroes" <spam@decroes.com> wrote in message news:729395.1062072620149.JavaMail.itn@is.intellij.net...

In my case I did have the directory marked as source. It's really my fault for not fixing the stupid directory structure. It

was

like that when I came and all the .bat and ant files will have to change.

>
>


0

Please sign in to leave a comment.