Home > Archive > Visual Basic > December 2005 > Identify current directory
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Identify current directory
|
|
| BobbyS 2005-12-18, 6:55 pm |
| Using VB 6.0, how do I identify the directory the current file is in?
I am creating an install program and I want to identfiy the current drive
then using that drive variable copy a folder (MyData) to c:\Program
Files\MyLog.
Something like this: CD inserted; identify the drive (do I need to
concantenate the : or \ after identification of drive?);copy folder to......
Thanks
| |
| Dmitriy Antonov 2005-12-18, 6:55 pm |
|
"BobbyS" <BobbyS@discussions.microsoft.com> wrote in message
news:D0004BD4-9DCC-4FCE-8E79-BB5267FD706B@microsoft.com...
> Using VB 6.0, how do I identify the directory the current file is in?
>
> I am creating an install program and I want to identfiy the current drive
> then using that drive variable copy a folder (MyData) to c:\Program
> Files\MyLog.
>
> Something like this: CD inserted; identify the drive (do I need to
> concantenate the : or \ after identification of drive?);copy folder
> to......
>
> Thanks
It depends of what do you mean under "current file". Path to executable
itself can be obtainted using app.path.
See MSDN for details.
Dmitriy.
| |
| Tom Esh 2005-12-18, 6:55 pm |
| On Sun, 18 Dec 2005 09:48:02 -0800, BobbyS
<BobbyS@discussions.microsoft.com> wrote:
>...
>Something like this: CD inserted; identify the drive (do I need to
>concantenate the : or \ after identification of drive?);copy folder to......
Technically drive names should not include the trailing "\". Path /
folder names also should not ~except~ in the case of a root dir (where
it is actually part of the name).
However rather than trying to remember the rules (and which functions
do or do not follow them), it's much safer to check it yourself before
appending path and/or filename.
Ex:
Public Function CheckPath(sPath As String) As String
'Append trailing "\" delimiter if not present
If Right$(sPath, 1) <> "\" Then
CheckPath = sPath & "\"
Else
CheckPath = sPath
End If
End Function
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
|
|
|
|
|