Results 1 to 5 of 5

Thread: App.Path & Temp Directory [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    App.Path & Temp Directory [RESOLVED]

    Hi, I'm copying one of my apps to the Temporary directory, which I retrieve through Environ("TEMP"). The path is returned like this: C:\Docume~1\Userna~1\Temp. When I start the app from the Temp directory I want to check if it's in the right directory. Therefore I check if the App.Path is equal to the Temp path. The App.Path, however, is returned like this: C:\Documents and Settings\Username\Temp. So when I compare the two, they are not equal. Is there a way to retrieve the complete Temporary path or the DOS-path of the application (the GetTempPath API doesn't work either...)?

    Thanks.
    Last edited by TheVader; Aug 31st, 2003 at 10:22 AM.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  2. #2
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    Check for the number of files and directory's, if both match you are quite sure it is the same directory
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  3. #3
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872
    This returns true on my computer:
    VB Code:
    1. MsgBox Dir(App.Path) = Dir(Environ("temp"))
    while this returns False
    VB Code:
    1. MsgBox App.Path = Environ("temp")
    - Use the thread tools to Mark your Thread as Resolved when your question is answered.
    - Please Rate my answers if they where helpful.

  4. #4

    Thread Starter
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    Thanks, but the first code returns true even when the app.path is not equal to the temp path. It only gets the first file in the directory (which fails because an additional slash is required) and thus compares nothing with nothing, which returns true.

    Thanks anyway. I guess I'll have to take Lightning's approach, but I can't believe there's no way to get the full path...
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  5. #5

    Thread Starter
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Solved!

    Finally found it! There's an API GetShortPathName that can convert the App.Path to a Short Path. Thanks folks.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width