Results 1 to 5 of 5

Thread: File access with Application Paths

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    Ireland
    Posts
    15

    Post

    Does anyone know how to use AppPath properly?

    I have created a setup file for my application and it will only work if users install it in a certain directory. I have been trying to use the $(AppPath) in the code and it simply won't work

    E.G. I have a directory testfiles as a subdirectory of the installation directory.
    At the moment in the code, I access files in that directory directly by c:\MyApplication\testfiles\whatever.file
    but I would like a way to be able to access it as
    (installation directory)\testfiles\whatever.file

    I know this can be done using $(AppPath) but have not found the correct way of doing this.
    Any of you out there got examples of how this can be done?

    Thanks.

  2. #2
    Lively Member
    Join Date
    Dec 1999
    Location
    Karlsruhe, Germany
    Posts
    122

    Post

    I usually use the following code:

    Code:
    Dim FileName as String
    
    FileName = App.Path
    If Right$(FileName, 1) <> "\" Then FileName = FileName & "\"
    FileName = FileName & "testfiles\whatever.file"
    ------------------

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    Ireland
    Posts
    15

    Post

    If you don't know what the path to the file is going to be before hand, then that won't work, thanks anyway.

  4. #4
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386

    Post

    Did you test it??
    App.Path returns the path where the program is installed...
    And if everything else fails, modify setup1.exe (source comes with VB), and save the path where the program is installed in the registry (useless though since app.path does the trick...)

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    Ireland
    Posts
    15

    Post

    No I didn't.
    I just didn't read it properly, not with it today, sorry about that. Thanks again.

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