File system driver.
"Thore Berntsen" <someone@microsoft,com> wrote in message
news:%23ic7MEmOHHA.400@TK2MSFTNGP04.phx.gbl...
> Thank you all!
>
> The Path.GetDirectoryName solved my problem.
> By the way, what is FSD short for?
>
> "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
> com> wrote in message news:Ot2G1TlOHHA.140@TK2MSFTNGP04.phx.gbl...
>> Maybe one device doesn't have the space in the directory name between
>> "storage" and "card"...
>>
>> Paul T.
>>
>> "<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote in message
>> news:%23sMjPDkOHHA.1252@TK2MSFTNGP02.phx.gbl...
>>> Not sure what explanation you're after. The devices behave differently
>>> because somewhere down in their FSD, the work a little differently. The
>>> point Peter is making is that folder names should not have the trailing
>>> slash and your search should strip them out with a Path.GetDirectoryName
>>> call to ensure this.
>>>
>>> Don't think of this as a bug where one device doesn't work - think of it
>>> as a bug where the others do work when they shouldn't.
>>>
>>>
>>> --
>>> Chris Tacke
>>> OpenNETCF Consulting
>>> Managed Code in the Embedded World
>>>
www.opennetcf.com >>> --
>>>
>>>
>>>
>>> "Thore Berntsen" <someone@microsoft,com> wrote in message
>>> news:%23KiOB3jOHHA.4644@TK2MSFTNGP03.phx.gbl...
>>>> Thank's but that doesn't really explain the differense in behavior from
>>>> device to device.
>>>>
>>>> The hardcoding of paths was just for the example. I never do this in a
>>>> application.
>>>>
>>>> Thore
>>>>
>>>> "Peter Foot [MVP]" <feedback@nospam-inthehand.com> wrote in message
>>>> news:91A7E2F4-21CE-4B72-A3ED-4FE2F3855FFF@microsoft.com...
>>>>> Normally a folder path would be expressed without the trailing slash
>>>>> character, so you should stick to the format of the second example.
>>>>> Path.GetDirectoryName() will return you a valid directory from a path.
>>>>> On a related note, you shouldn't hard code your paths to "Storage
>>>>> Card" since this varies between devices e.g. CF Card, SD Card etc. An
>>>>> easy way to retrieve card names is to get all the directories off the
>>>>> root folder which have the Temporary attribute. e.g.
>>>>>
>>>>> DirectoryInfo rootDir = new DirectoryInfo("\\");
>>>>>
>>>>> //add all removable drives
>>>>> foreach (DirectoryInfo di in rootDir.GetDirectories())
>>>>> {
>>>>> //if directory and temporary
>>>>> if ((di.Attributes &
>>>>> System.IO.FileAttributes.Temporary) ==
>>>>> System.IO.FileAttributes.Temporary)
>>>>> {
>>>>> //folder is a removable card
>>>>> }
>>>>> }
>>>>>
>>>>> Peter
>>>>>
>>>>> --
>>>>> Peter Foot
>>>>> Device Application Development MVP
>>>>>
www.peterfoot.net |
www.inthehand.com >>>>>
>>>>> "Thore Berntsen" <someone@microsoft,com> wrote in message
>>>>> news:%23XCgAQjOHHA.4376@TK2MSFTNGP02.phx.gbl...
>>>>>>I have a CF 2.0 program where I have code like this:
>>>>>>
>>>>>> if (Directory.Exists("\\Storage Card\\Import\\) ...
>>>>>>
>>>>>> This works on all devices I tried yet except for the ViewSonic V.37.
>>>>>> On this device the call returns false even if the directory exists.
>>>>>>
>>>>>> If I write
>>>>>> if (Directory.Exists("\\Storage Card\\Import) ... (Without trailing
>>>>>> backslash) it works fine.
>>>>>>
>>>>>> It is not releated to the storage card. I have tested that.
>>>>>>
>>>>>> Ideas anyone?
>>>>>>
>>>>>> Thore Berntsen
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>