Xojo Conferences
XDCMay2019MiamiUSA

Re: Quick question about GetFolderItem.Child() method (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Selecting multiple rows in a listbox
Next thread: Re: ColumnFromXY/RowFromXY [SOLVED]


Re: Quick question about GetFolderItem.Child() method   -   Ing. Antonio Rinaldi
  Re: Quick question about GetFolderItem.Child() method   -   Dave Duke
  Re: Quick question about GetFolderItem.Child() method   -   Michael Potts
   Quick question about GetFolderItem.Child() method   -   Michael Potts
    Re: Quick question about GetFolderItem.Child() method   -   Glenn L. Austin
    Re: Quick question about GetFolderItem.Child() method   -   Norman Palardy
    Re: Quick question about GetFolderItem.Child() method   -   Jean-Luc Arnaud
    Re: Quick question about GetFolderItem.Child() method   -   Charles Yeomans
     Re: Quick question about GetFolderItem.Child() method   -   Michael Potts

Re: Quick question about GetFolderItem.Child() method
Date: 03.08.12 12:27 (Fri, 03 Aug 2012 13:27:05 +0200)
From: Ing. Antonio Rinaldi
Dim inFile as FolderItem
inFile=SpecialFolder.Home.Child("myapp").Child("myapp.cfg")

However it's better to check if child("myapp") exists

Il giorno 03/08/12 13:17, "Michael Potts" <<email address removed>> ha
scritto:

>So I'm trying to associate a FolderItem with a file in a Linux users
>/home/myapp
>directory. The file is called myapp.cfg. I thought I should be able to do
>this
>
>Dim inFile as GetFolderItem
>inFile =
>GetFolderItem(SpecialFolder.Home.Child("myapp").Child("myapp.cfg"))
>
>But, apparently, that doesn't work. I've read the doc and I'm at a loss
>(being
>kind of new still). Can anyone tell me what I'm doing wrong or point me in
>the
>right direction?
>
>Thanks!
>Mike
>
>_______________________________________________
>Unsubscribe or switch delivery mode:
><http://www.realsoftware.com/support/listmanager/>
>Search the archives:
><http://support.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Quick question about GetFolderItem.Child() method
Date: 03.08.12 17:32 (Fri, 3 Aug 2012 17:32:34 +0100)
From: Dave Duke
Add somthing like this

If specialfolder.home.child("my app").exists = false then
Specialfolder.home.child("my app").createaafolder
End if


On 3 Aug 2012, at 12:27, "Ing. Antonio Rinaldi" <<email address removed>> wrote:

> Dim inFile as FolderItem
> inFile=SpecialFolder.Home.Child("myapp").Child("myapp.cfg")
>
> However it's better to check if child("myapp") exists
>
> Il giorno 03/08/12 13:17, "Michael Potts" <<email address removed>> ha
> scritto:
>
>> So I'm trying to associate a FolderItem with a file in a Linux users
>> /home/myapp
>> directory. The file is called myapp.cfg. I thought I should be able to do
>> this
>>
>> Dim inFile as GetFolderItem
>> inFile =
>> GetFolderItem(SpecialFolder.Home.Child("myapp").Child("myapp.cfg"))
>>
>> But, apparently, that doesn't work. I've read the doc and I'm at a loss
>> (being
>> kind of new still). Can anyone tell me what I'm doing wrong or point me in
>> the
>> right direction?
>>
>> Thanks!
>> Mike
>>
>> _______________________________________________
>> Unsubscribe or switch delivery mode:
>> <http://www.realsoftware.com/support/listmanager/>
>>
>> Search the archives:
>> <http://support.realsoftware.com/listarchives/lists.html>
>>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Quick question about GetFolderItem.Child() method
Date: 03.08.12 14:10 (Fri, 3 Aug 2012 06:10:40 -0700 (PDT))
From: Michael Potts
Thank you sir! That worked great! Unfortunately, it lead me down the path to yet
another question! lol


----- Original Message ----
From: Ing. Antonio Rinaldi <<email address removed>>
To: RB-NUG <<email address removed>>
Sent: Fri, August 3, 2012 6:27:18 AM
Subject: Re: Quick question about GetFolderItem.Child() method

Dim inFile as FolderItem
inFile=SpecialFolder.Home.Child("myapp").Child("myapp.cfg")

However it's better to check if child("myapp") exists

Il giorno 03/08/12 13:17, "Michael Potts" <<email address removed>> ha
scritto:

>So I'm trying to associate a FolderItem with a file in a Linux users
>/home/myapp
>directory. The file is called myapp.cfg. I thought I should be able to do
>this
>
>Dim inFile as GetFolderItem
>inFile =
>GetFolderItem(SpecialFolder.Home.Child("myapp").Child("myapp.cfg"))
>
>But, apparently, that doesn't work. I've read the doc and I'm at a loss
>(being
>kind of new still). Can anyone tell me what I'm doing wrong or point me in
>the
>right direction?
>
>Thanks!
>Mike
>
>_______________________________________________
>Unsubscribe or switch delivery mode:
><http://www.realsoftware.com/support/listmanager/>
>Search the archives:
><http://support.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Quick question about GetFolderItem.Child() method
Date: 03.08.12 12:17 (Fri, 3 Aug 2012 04:17:58 -0700 (PDT))
From: Michael Potts
So I'm trying to associate a FolderItem with a file in a Linux users /home/myapp
directory. The file is called myapp.cfg. I thought I should be able to do this

Dim inFile as GetFolderItem
inFile = GetFolderItem(SpecialFolder.Home.Child("myapp").Child("myapp.cfg"))

But, apparently, that doesn't work. I've read the doc and I'm at a loss (being
kind of new still). Can anyone tell me what I'm doing wrong or point me in the
right direction?

Thanks!
Mike

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Quick question about GetFolderItem.Child() method
Date: 03.08.12 16:37 (Fri, 3 Aug 2012 08:37:08 -0700)
From: Glenn L. Austin
On Aug 3, 2012, at 4:17 AM, Michael Potts <<email address removed>> wrote:

> So I'm trying to associate a FolderItem with a file in a Linux users /home/myapp
> directory. The file is called myapp.cfg. I thought I should be able to do this
>
> Dim inFile as GetFolderItem
> inFile = GetFolderItem(SpecialFolder.Home.Child("myapp").Child("myapp.cfg"))
>
> But, apparently, that doesn't work. I've read the doc and I'm at a loss (being
> kind of new still). Can anyone tell me what I'm doing wrong or point me in the
> right direction?
>
> Thanks!
> Mike

If you aren't sure that everything along your path exists (e.g. the "myapp" directory), then you can't use child of child directly, since anything along that path *could* return either return NULL or not a directory -- for example, if ~/myapp doesn't exist or is a file, then ~/myapp/myapp.cfg is undefined since ~/myapp is NOT a directory!).

You could easily have a routine that could build the directory path for you (similar to "mkdir -p path/to/parent/directory") that took a parent directory FolderItem and an array of directory name strings for the path relative to that FolderItem. Design it such that it returned a valid parent directory folder item if it was able to either create or use that directory path, nil if there was any error (un-readable directory, file instead of directory, etc).

Re: Quick question about GetFolderItem.Child() method
Date: 03.08.12 15:06 (Fri, 3 Aug 2012 08:06:56 -0600)
From: Norman Palardy

On 2012-08-03, at 5:17 AM, Michael Potts wrote:

> So I'm trying to associate a FolderItem with a file in a Linux users /home/myapp
> directory. The file is called myapp.cfg. I thought I should be able to do this
>
> Dim inFile as GetFolderItem
> inFile = GetFolderItem(SpecialFolder.Home.Child("myapp").Child("myapp.cfg"))
>
> But, apparently, that doesn't work. I've read the doc and I'm at a loss (being
> kind of new still). Can anyone tell me what I'm doing wrong or point me in the
> right direction?

Dim inFile as GetFolderItem

// does the dir "myapp" exist in the users home dir ?
inFile = SpecialFolder.Home.Child("myapp")
if inFile = nil or inFile.exists = false then return // bail early & often although return may not be right

// does the file "myapp/myapp.cfg" exist in the users home dir ?
infile = infile.Child("myapp.cfg")
if inFile = nil or inFile.exists = false then return // bail early & often although return may not be right

return infile // we know that it exists

Norman Palardy



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Quick question about GetFolderItem.Child() method
Date: 03.08.12 14:17 (Fri, 03 Aug 2012 15:17:34 +0200)
From: Jean-Luc Arnaud
AFAIK, it seems obvious:

GetFolderItem parameter is a Path, that is a string.

Child returns a FolderItem.

You should use AbsolutePath as below:

inFile = GetFolderItem(SpecialFolder.Home.Child("myapp").Child("myapp.cfg").AbsolutePath,0)

HTH

Jean-Luc

Le 03/08/12 13:17, Michael Potts a écrit :
> So I'm trying to associate a FolderItem with a file in a Linux users /home/myapp
> directory. The file is called myapp.cfg. I thought I should be able to do this
>
> Dim inFile as GetFolderItem
> inFile = GetFolderItem(SpecialFolder.Home.Child("myapp").Child("myapp.cfg"))
>
> But, apparently, that doesn't work. I've read the doc and I'm at a loss (being
> kind of new still). Can anyone tell me what I'm doing wrong or point me in the
> right direction?
>
> Thanks!
> Mike
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

-

Re: Quick question about GetFolderItem.Child() method
Date: 03.08.12 12:36 (Fri, 3 Aug 2012 07:36:35 -0400)
From: Charles Yeomans

On Aug 3, 2012, at 7:17 AM, Michael Potts <<email address removed>> wrote:

> So I'm trying to associate a FolderItem with a file in a Linux users /home/myapp
> directory. The file is called myapp.cfg. I thought I should be able to do this
>
> Dim inFile as GetFolderItem
> inFile = GetFolderItem(SpecialFolder.Home.Child("myapp").Child("myapp.cfg"))
>
> But, apparently, that doesn't work. I've read the doc and I'm at a loss (being
> kind of new still). Can anyone tell me what I'm doing wrong or point me in the
> right direction?

Would you tell us how it does not work?

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Quick question about GetFolderItem.Child() method
Date: 03.08.12 14:17 (Fri, 3 Aug 2012 06:17:25 -0700 (PDT))
From: Michael Potts
----- Original Message ----

From: Charles Yeomans <<email address removed>>
To: Realbasic NUG <<email address removed>>
Sent: Fri, August 3, 2012 6:36:44 AM
Subject: Re: Quick question about GetFolderItem.Child() method

On Aug 3, 2012, at 7:17 AM, Michael Potts <<email address removed>> wrote:

>
> But, apparently, that doesn't work. I've read the doc and I'm at a loss (being

> kind of new still). Can anyone tell me what I'm doing wrong or point me in the

> right direction?
>
> Would you tell us how it does not work?

Hi Charles! It wasn't compiling. I was getting a type mismatch error. But it
seems to work with the suggested changes!

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>