Re: Warp: RSS Package Manager
"Neil Munro" <[email protected]>
| Newsgroups | gmane.comp.autopackage.devel |
|---|---|
| Message-ID | <[email protected]> |
2008/5/31 Isak Savo <[email protected]>: > On Fri, May 30, 2008 at 3:12 PM, Neil Munro <[email protected]> wrote: > > 2008/5/30 Isak Savo <[email protected]>: > >> > >> On Wed, May 28, 2008 at 2:22 PM, Neil Munro <[email protected]> > wrote: > >> > > >> > 2008/5/28 Isak Savo <[email protected]>: > >> >> > >> In your case, you'd need to check that mono exists and that its the > >> correct version. We currently don't support this, but work has at > >> least started ( http://trac.autopackage.org/wiki/PackagingMonoApps ). > > > > Looking at the quick start guide and I get to the binreloc stage is there > a > > C# mode for binreloc? I don't have any hard coded paths at the moment, > > everything is all contained in a relative directory so I do even need to > use > > binreloc at this point? > > Yes, you need binreloc. As long as you rely on getting external files > from the hard drive you'll need binreloc. > > I did actually write a C# version of binreloc a year ago or so, It's > available here: > http://isak.livejournal.com/11225.html > > Just grab the BinReloc.cs and include it in your project. > > The blog post contains a short example on how to use it. Ok, I shall try this then :) I imagine I'm going to get stuck further down the line though, so expect more questions. > > > >> Ok, I understand. > > > > Is that practice frowned upon? I'm learning to program all by myself > without > > any one really showing me better ways of doing things and best practice > > methods and I would prefer to get things efficient and right if I can. So > if > > my work around is a bit nasty and hacky I'll move back to bitwise > > operations. Can probably fix the dependency by checking if the system is > a > > unix one only then use Mono.Native.Unix.UnixFileProcess that works around > > the dependency issue on windows. > > In C, you typically solve this using some abstraction layer, then > using #ifdef and/or separate source files depending on platform your > compiling on. > > So you'd perhaps have: > > bool change_permission(string file, string permission) > { > #ifdef UNIX > chmod(file, permission) > #else if WINDOWS > ChangePermission(file, permission); > #endif > } The code is used was this: if ( Environment.OSVersion.ToString( ).ToLower( ).Contains( "unix" ) ) { string sArgs = "+x " + sFileName; Process pSetPermissions = new Process( ); pSetPermissions.StartInfo.FileName = "chmod"; pSetPermissions.StartInfo.Arguments = sArgs; pSetPermissions.Start( ); pSetPermissions.WaitForExit( ); } And I don't quite know how often yet it could be called. > > > This can be done similarily in C# too, but then you'd need to compile > once for each platform. Don't know if that's ok with you. > > It all depends on how frequently you need to do this kind of stuff in > your code. If it was just one or a few places, I'd probably just do > like you did and call an external program: > > System.Diagnostics.Process.Start("chmod", myFile + " " + myPermission); > > If it was a lot of things and used at many places in the code, I'd > write an abstraction layer that took care of the platform specific > details > > -Isak > > --------------------------------------------------------------------- > To unsubscribe, e-mail: autopackage-dev-unsubscribe-OfajU3CKLf1/[email protected] > For additional commands, e-mail: autopackage-dev-help-OfajU3CKLf1/[email protected] > >