Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Unexpected nil folderitem on USB thumb drive (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Re: OT: Pricing and Sales advice
Next thread: Re: What is the best way to keep two directories in sync? (on Windows)


Re: REAL and InnoSetup question   -   Garth Hjelte
  Unexpected nil folderitem on USB thumb drive   -   wagnerj proaxis.com
   Re: Unexpected nil folderitem on USB thumb drive   -   wagnerj proaxis.com
    Re: Unexpected nil folderitem on USB thumb drive   -   Roger Clary
   Re: Unexpected nil folderitem on USB thumb drive   -   Someone
   Re: Unexpected nil folderitem on USB thumb drive   -   Craig Finseth

Unexpected nil folderitem on USB thumb drive
Date: 02.08.10 23:30 (Mon, 2 Aug 2010 15:30:36 -0700 (PDT))
From: wagnerj proaxis.com
Greetings -

I have a USB thumb drive (FAT32) and I test for the existence of a
specified folder. First, I create the folder item with

f = GetFolderItem(shellpath,folderitem.PathTypeShell).

When the folder item IS there, f.exists returns true, as I would expect.

But, when I remove the folder item before the test, f is nil! On the
regular (MacOS) harddrive, f is NOT nil but f.exists is false, as I would
expect.

I had planned to work my way up the file path until a folder that exists
can be found, then recreate the folder chain. But, with a nil f, you
cannot find the parent. This is RB2009R3.

Any suggestions?

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

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

Re: Unexpected nil folderitem on USB thumb drive
Date: 03.08.10 00:14 (Mon, 2 Aug 2010 16:14:15 -0700 (PDT))
From: wagnerj proaxis.com
> Greetings -
>
> I have a USB thumb drive (FAT32) and I test for the existence of a
> specified folder. First, I create the folder item with
>
> f = GetFolderItem(shellpath,folderitem.PathTypeShell).
>
> When the folder item IS there, f.exists returns true, as I would expect.
>
> But, when I remove the folder item before the test, f is nil! On the
> regular (MacOS) harddrive, f is NOT nil but f.exists is false, as I would
> expect.
>
> I had planned to work my way up the file path until a folder that exists
> can be found, then recreate the folder chain. But, with a nil f, you
> cannot find the parent. This is RB2009R3.
>
> Any suggestions?
>

Further followup -

If JUST the LAST folder in the chain is missing on the thumb drive, it
behaves as expected with a non-nil folderitem and f.exists = false. It
appears only to happen when a parent to the last folder is removed. AND,
the SAME appears true on MacOS.

Again, any suggestions?

Jim

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

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

Re: Unexpected nil folderitem on USB thumb drive
Date: 03.08.10 01:21 (Mon, 2 Aug 2010 20:21:03 -0400)
From: Roger Clary

On Aug 2, 2010, at 7:14 PM, <email address removed> wrote:

>> Greetings -
>>
>> I have a USB thumb drive (FAT32) and I test for the existence of a
>> specified folder. First, I create the folder item with
>>
>> f = GetFolderItem(shellpath,folderitem.PathTypeShell).
>>
>> When the folder item IS there, f.exists returns true, as I would expect.
>>
>> But, when I remove the folder item before the test, f is nil! On the
>> regular (MacOS) harddrive, f is NOT nil but f.exists is false, as I would
>> expect.
>>
>> I had planned to work my way up the file path until a folder that exists
>> can be found, then recreate the folder chain. But, with a nil f, you
>> cannot find the parent. This is RB2009R3.
>>
>> Any suggestions?
>>
> Further followup -
>
> If JUST the LAST folder in the chain is missing on the thumb drive, it
> behaves as expected with a non-nil folderitem and f.exists = false. It
> appears only to happen when a parent to the last folder is removed. AND,
> the SAME appears true on MacOS.
>
> Again, any suggestions?

This is the behavior I have seen.

f = GetFolderItem(Existingfol.Child(ExistingFol2).Child(nonExistingFile)

f will be non-Nil and f.Exists will be false

f = GetFolderItem(ExistingFol.Child(NonExistingFol).Child(existingFile)

f will be Nil

The best suggestion I can give is to work your way up the hierarchy checking for Exists = False at each step.

Roger Clary
Class One Software
http://www.classonesoftware.com
Educational Software for Lifelong Learning



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

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

Re: Unexpected nil folderitem on USB thumb drive
Date: 03.08.10 18:35 (Tue, 03 Aug 2010 19:35:51 +0200)
From: Someone
Le 3 août 10 à 02:21, Roger Clary a écrit:

>> If JUST the LAST folder in the chain is missing on the thumb drive,
>> it
>> behaves as expected with a non-nil folderitem and f.exists = false.
>> It
>> appears only to happen when a parent to the last folder is removed.
>> AND,
>> the SAME appears true on MacOS.
>>
>> Again, any suggestions?
>
> This is the behavior I have seen.
>
> f =
> GetFolderItem(Existingfol.Child(ExistingFol2).Child(nonExistingFile)
>
> f will be non-Nil and f.Exists will be false
>
> f =
> GetFolderItem(ExistingFol.Child(NonExistingFol).Child(existingFile)
>
> f will be Nil

At least, it's logical. An item that does not exist isn't a folder
(it's "directory" property is false) and you can't have a child of a
"non-folder" object. An item that does not exist is just not nil to
allow for creating it.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

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

Re: Unexpected nil folderitem on USB thumb drive
Date: 23.03.01 19:33 (Tue, 3 Aug 2010 07:19:54 -0500 (CDT))
From: Craig Finseth
f will be non-Nil and f.Exists will be false

f = GetFolderItem(ExistingFol.Child(NonExistingFol).Child(existingFile)

f will be Nil

The best suggestion I can give is to work your way up the hierarchy
checking for Exists = False at each step.

Definitely. Always assume that any allocated (i.e., new) object can be nil.

Check for it with an if or with an exception.

Otherwise, your program will show those wonderful "nil object
exception" messages and leave your users wondering why they ever
bothered with you.

Craig

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

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