Where is PROJECT_DIR set?

I have done some rearranging of my user accounts in OS X and I'm finding that when I open projects in IntelliJ PROJECT_DIR is "set" to the old user account.

Where is PROJECT_DIR set in IntelliJ for a project? I would like to be able to edit this and keep all of my configurations instead of recreating all of the project definitions.

-- Randy

7 comments

Hi.

PROJECT_DIR is not configured manually. It always points to the directory with .ipr file or .idea sub-directory (with project settings).

Regards,
Alexander.

0

Alexander,

Thanks for the reply. I now understand how it is supposed to work.

Maybe there is a bug I have discovered then. The problem is appearing after I moved the contents of one OS X User to another by using a mass copy. The directory structures are the same underneath the /Users/newuser location. However, PROJECT_DIR is still pointing to /User/olduser directory structure.

When, within the /Users/newuser location, I create a new project directory and copy the contents of the original project to the new location then the PROJECT_DIR _is_ pointing to the right location.

So, this almost works. Just not in the case where the difference in the project location is /Users/newuser.

Should I report this as a bug?

Randy

0

Well, if we've got (this or that way) project files in /Users/newuser/project-path/.idea, and xml configs in .idea contain PROJECT_DIR macro, it can be resolved only to /Users/newuser/project-path/. IDEA just has no "memory" about where has this PROJECT_DIR come from.

So, I have to ask:
1. Is .idea directory really under /Users/newuser/project-path/ or somewhere else?
2. Why do you think that PROJECT_DIR points to wrong location? What's wrong in IDEA's behavior? Maybe, another macro works wrong.

Alexander.

0

Alexander,

I am not using the directory structure option for the project. I'm using *.ipr and *.iws files.

I know that the PROJECT_DIR is set incorrectly because when I open the project I get a message that the *.iws file cannot be updated because it is "protected". When I look carefully, it is still pointing to the path with /Users/olduser and not /Users/newuser.

I found that the following does fix the problem:

1. Rename /Users/newuser/git/project/projectdirectory (which contains the *.ipr and *.iws files) to /Users/newuser/git/project/projectdirectory-old
2. Run IntelliJ by double-clicking on the *.ipr file.
3. Change the project, exit IntelliJ
4. Rename ../projectdirectory-old to ../projectdirectory

Now it works just fine - the PROJECT_DIR reference points to the new path /Users/newuser/git/project/projectdirectory and I can maintain the *.iws file state correctly.

Does this help you isolate what is going wrong?

Thanks -- Randy

0

I have found only one message with "protected" word in sources: "The file is on read-only media, or the media is write protected." Is this it?

> When I look carefully, it is still pointing to the path with /Users/olduser and not /Users/newuser
Look carefully - where? In the message text? What is that text?
Or into the project config files? And what path was in that config, in what element?

I understand that something goes unexpected. But it's important what do you see exactly.

Thank you,
Alexander.

0

Alexander,

I am looking at IntelliJ right now going through the scenario...

When IntelliJ tries to save the information for the project, it pops up a dialog box with the title bar text set to "Clear Read-only Status". The list contains the project's *.iws file listed (to the old user path). I get _only_ the radio button option "Using File System" (which is selected). If I press "OK" then nothing happens. If I hit "Cancel",the dialog goes away and then a dialog pops up with the title bar text set to "Error". The dialog text is:

Could not save project:
Failed to make /Volumes/Macintosh HD/Users/olduser/git/project/{project-directory}/{project-name}.iws writeable.

Pressing the OK button makes this go away and then I'm back to IntelliJ's main IDE window.

Regards,

Randy

0

Alexander,

Now I'm not sure about this issue. I went to check again by running the projects from the Finder and now I cannot reproduce the failure. Maybe I've messed with permissions, etc. enough that I've destroyed the test case.

I'll keep trying to reproduce it again and let you know.

Randy

0

Please sign in to leave a comment.