aBothe / Mono-D

D Add-In for MonoDevelop
http://wiki.dlang.org/Mono-D
Other
113 stars 26 forks source link

output dir converted to relative, stops working #600

Closed nicolasjinchereau closed 9 years ago

nicolasjinchereau commented 9 years ago

2.10.8 In project properties for a static library project, I set the "Output directory" on "Linking" page to an absolution path. Project builds fine. When I open project properties again, "Output directory" has been converted to a relative path. If I push "OK" to save the settings again, project will not build.

Error:

Build failed. Can't create project output directory lib/macosx/Debug original exception: System.UnauthorizedAccessException: Access to the path "/lib" is denied. at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in :0 at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in :0 at System.IO.DirectoryInfo.Create () [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create () at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in :0 at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in :0 at System.IO.DirectoryInfo.Create () [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create () at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in :0 at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in :0 at System.IO.DirectoryInfo.Create () [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create () at MonoDevelop.Projects.Project.OnBuild (IProgressMonitor monitor, MonoDevelop.Projects.ConfigurationSelector configuration) [0x00092] in /Users/builder/data/lanes/1494/04666fd4/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:447 Build: 1 error, 0 warnings

nicolasjinchereau commented 9 years ago

"Access to the path "/lib" is denied." The leading slash shouldn't be there for a relative path.. is this within the scope of Mono-D, or is this a monodevelop problem?

nicolasjinchereau commented 9 years ago

Could this happen if ToRelative is called a second time on an OutputPath which is already relative? Will ToRelative() on a relative Output path against the project base dir make the output path relative to the root?

aBothe commented 9 years ago

sry for the late answer, the problem is mono-d's fault. It should be easy to fix.

nicolasjinchereau commented 9 years ago

Awesome, thanks =)

aBothe commented 9 years ago

This ugly-ass addins publishing system from MonoDevelop still isn't working again.. meh :/ Please get mono-d from here for now http://mono-d.alexanderbothe.com/repo/MonoDevelop.D_2.11.2.mpack

nicolasjinchereau commented 9 years ago

Xamarin Studio 5.9.427

When I tried to install MonoDevelop.D_2.11.2.mpack, I got this error: "The installation failed! Could not read addin description."

After the above error, I restarted XS, and the plugin seemed to have installed anyways, but building my project gave the same error as before.

Then, I downloaded Mono-D source, and ran it myself (pushing play in XS) and things seemed to be working.

totally confused.

aBothe commented 9 years ago

Please excuse the extra circumstances. It's currently a rather complicated situation with a new major release of Xamarin Studio being rolled out (slowly). When building Mono-D on your own, you need to put the MonoDevelop.D.dll and D_Parser.dll somewhere into the Addins-folder of XamarinStudio. Otherwise it won't take the custom build.

nicolasjinchereau commented 9 years ago

I tried copying MonoDevelop.D.dll, and all dependancies into /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.D/

Now, it seems to be installed, but still giving the same error.

"Access to the path "/lib" is denied."

aBothe commented 9 years ago

you have to edit the project settings once again, so leading and traling slashs will be stripped off.

nicolasjinchereau commented 9 years ago

I did, and the box now reads "lib/macosx/Debug" which is correct

aBothe commented 9 years ago

so has the problem been solved then? :)

nicolasjinchereau commented 9 years ago

Not sure... I'm just gonna wait until the published version comes out. I still don't have an answer for why it works when I run it with XS attached, but then fails when I build/install the addin..

Anyways, thanks for the help!

aBothe commented 9 years ago

https://bugzilla.xamarin.com/show_bug.cgi?id=28945 I already filed an issue report a couple of weeks ago, so they will hopefully fix the publishing issue soon. Thanks for your patience! :)

nicolasjinchereau commented 9 years ago

It's ok. They have to run out of things to break sooner or later ;)

nicolasjinchereau commented 9 years ago

I'm looking at ProjectBuilder.cs right now, but I don't see any code responsible for creating the output path..does XS create it for you?

nicolasjinchereau commented 9 years ago

I guess I should take your silence as RTMF? ;)

aBothe commented 9 years ago

Oh, I read the notification mail but forgot to answer. Well, the output path is generated by the project's configuration that is used for building - there, the base path and the relative output path are combined and then used e.g. in ProjectBuilder :)

nicolasjinchereau commented 9 years ago

I meant the actually directory on the HD. I did a search for "Directory.Create" and found only the code for creating the Objects directory. I checked CBinding too, which also has no such code, so I'm gonna assume XS "tries" to create it for you.

aBothe commented 9 years ago

Not sure, perhaps even dmd is responsible for this. Or XS itself. I didn't spend a look on the code for too long now, so I can't remember anymore.

nicolasjinchereau commented 9 years ago

Ok, thanks again.

nicolasjinchereau commented 9 years ago

Ok, Sorry to keep bothering you, but I think I found a fix.

Basically, I'm assigning an absolute path to ProjectOptions.OutputDirectory.

When XS saves the project to file, it automatically makes the path relative to SolutionDir, and when the project is loaded from file, the relative path is converted back into absolution and stored in ProjectOptions.OutputDirectory.

So I changed to this, and now everything is working again:

Load() { text_BinDirectory.Text = config.OutputDirectory.ToRelative(proj.BaseDirectory); ...

Store() { configuration.OutputDirectory = new FilePath(text_BinDirectory.Text).ToAbsolute(project.BaseDirectory);

aBothe commented 9 years ago

Is it? Okay nice, didn't expect something like this (although it makes more than sense that XS does this on its own)

nicolasjinchereau commented 9 years ago

Seems to be the case on OSX. Ill check on windows to make sure.

nicolasjinchereau commented 9 years ago

Ok, tested on windows, and it works too. Windows 8.1, OSX Yosemite, XS 5.9, git head + my changes

aBothe commented 9 years ago

What did you change to get it working (my changes)?

nicolasjinchereau commented 9 years ago

I did a pull for it. It seems that your original code should behave exactly the same, but the current version of mono-D breaks for me.

aBothe commented 9 years ago

I did the very same you did. Thanks for the recommendations though!

nicolasjinchereau commented 9 years ago

Ok, I guess I'll just put this bug report on my resume ;) Thanks

aBothe commented 9 years ago

I think I may close this issue then.