[Gambas-user] Acting on a file in the local folder of a Gambas project

Ru Vuott vuott at ...325...
Sun Jan 6 01:28:40 CET 2013


Ah, Ok.

Thanks a lot, Bruce.

vuott




--- Dom 6/1/13, Bruce <bbruen at ...2308...> ha scritto:

> Da: Bruce <bbruen at ...2308...>
> Oggetto: Re: [Gambas-user] Acting on a file in the local folder of a Gambas project
> A: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
> Cc: gambas at ...1...
> Data: Domenica 6 gennaio 2013, 00:25
> Hi Vuott,
> 
> The answer lies in understanding the difference between
> relative and
> absolute paths in the gambas runtime.  There is some
> help at
> http://gambasdoc.org/help/cat/path?pt&v3
> 
> 
> Some comments inline below
> 
> On Sat, 2013-01-05 at 22:45 +0000, Ru Vuott wrote:
> > Hello,
> > 
> > 
> > I don't understand...
> > 
> > I have a file in local folder of my Gambas project, if
> my Gambas code is:
> > 
> >    Copy "myFile" To User.Home &/
> "myFile"
> > 
> > it's possible copy the file;
> Here you are using a relative path to a file inside the
> executable, not
> the file in your source directory. So, as per the pemissions
> revealed by
> your Print Stat(..) below, you can Copy it somewhere else.
> > 
> > 
> > But if the code is:
> > 
> >    Move "myFile" To User.Home &/
> "myFile"
> > 
> > it isn't possible to move the file.
> > Infact an error returns: "Access forbidden".
> Yes because the permissions for the file inside the
> executable are read
> only and Move, i.e. Copy + Delete cannot be achieved.
> 
> > 
> > But, with "Move" if that code is:
> > 
> >    Move Application.Path &/ "myFile" to
> User.Home &/ "myFile"
> > 
> > it' s OK. No errors.
> Here you are using an absolute path, i.e. your source
> directory, and as
> per the second Stat below you do have Write access to that
> real file.
> > 
> > ''''''
> > 
> > So if the code is:
> > 
> >    Print Stat("myFile").Auth
> > 
> > the permissions are:  r--------
> > 
> > but if the code is:
> > 
> >    Print Stat(Application.Path &/
> "myFile").Auth
> > 
> > the console shows these permissions: rw-rw-r--
> > 
> > ''''''
> > 
> > And more.
> > 
> >    File.Save("myFile", "this is my file")
> > 
> > it isn't possible to save the file: "Access
> forbidden".
> Again, the relative path means that you are trying to access
> the file
> that has been compressed inside the executable and no write
> access is
> allowed.
> 
> > 
> > 
> > BUT:
> > 
> >    string = File.Load("myFile")
> > 
> > this is possible !!!
> As per the first example.
> 
> > 
> > And:
> >    
> >    File.Save(Application.Path &/
> "myFile", "this is my file")
> > 
> > this is possible.
> Again, the absolute path means this is trying to save the
> real file
> inside your source project.
> 
> > 
> > '''
> > 
> > I don't understand why those different results (IF the
> "path" of file is made plain and IF not).
> See the help page.
> 
> > 
> > Regards
> > vuott
> > 
> >
> ------------------------------------------------------------------------------
> > Master Visual Studio, SharePoint, SQL, ASP.NET, C#
> 2012, HTML5, CSS,
> > MVC, Windows 8 Apps, JavaScript and much more. Keep
> your skills current
> > with LearnDevNow - 3,200 step-by-step video tutorials
> by Microsoft
> > MVPs and experts. SALE $99.99 this month only -- learn
> more at:
> > http://p.sf.net/sfu/learnmore_122912
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> Hope that helps
> 
> regards
> Bruce
> 
> 
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012,
> HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your
> skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by
> Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more
> at:
> http://p.sf.net/sfu/learnmore_122912
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list