|
-
Sep 24th, 2002, 04:46 PM
#1
Thread Starter
Junior Member
App.Path and networks?
Hello,
I was hoping that a application which reads files using App.Path (i.e. files are stored relative to .exe) would work over a network but apparently not.
Apparently it works OK on the server (as expected) but when a client machine runs the .exe (and it's just running the .exe on the server whcih has been shared), it cannot access the files. I cant check this myself but presumably something is going wrong with App.Path when used over a network? But the .exe being run on the client is located on the server so cant see why App.Path would change!
Am I overlooking something or is it a case of something being wrong with App.Path on a network?
Thanks
-
Sep 24th, 2002, 04:49 PM
#2
Addicted Member
Re: App.Path and networks?
Originally posted by TomJones
Hello,
I was hoping that a application which reads files using App.Path (i.e. files are stored relative to .exe) would work over a network but apparently not.
Apparently it works OK on the server (as expected) but when a client machine runs the .exe (and it's just running the .exe on the server whcih has been shared), it cannot access the files. I cant check this myself but presumably something is going wrong with App.Path when used over a network? But the .exe being run on the client is located on the server so cant see why App.Path would change!
Am I overlooking something or is it a case of something being wrong with App.Path on a network?
Thanks
Can you give us an example of what it returns? My guess is the UNC, in which case you'll need to ensure that the proper permissions are on the network share.
-
Sep 24th, 2002, 04:50 PM
#3
-
Sep 24th, 2002, 04:53 PM
#4
Need-a-life Member
You can use this function to be sure that no matter if it's a shared folder, a root folder (of a harddrive) or whatever. They will all retrieve the path without the trailing slash:
VB Code:
Option Explicit
Private Sub Form_Load()
MsgBox AppPath
End Sub
Public Function AppPath() As String
AppPath = App.Path
If Right$(App.Path, 1) = "\" Then
AppPath = Left$(AppPath, Len(AppPath) - 1)
End If
End Function
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Sep 24th, 2002, 05:18 PM
#5
Addicted Member
Originally posted by Mc Brain
App.Path will return you the trailing slash if it's working in a shared folder.
Ah hah, good point! Another option is to use the following:
MsgBox IIF(Right(App.Path, 1) = "\", Left(App.Path, Len(App.Path) -1), App.Path)
-
Sep 24th, 2002, 05:21 PM
#6
Need-a-life Member
Originally posted by Sheppe
Ah hah, good point! Another option is to use the following:
MsgBox IIF(Right(App.Path, 1) = "\", Left(App.Path, Len(App.Path) -1), App.Path)
It is!!.... If you're going to use it like only once in the whole project. Even if you copy & paste that... is a pain in the a... there to look for it to copy & paste, or even re-writting the whole line multiple times. Best approach.... create a function (like I did), and add the code you like best.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Sep 24th, 2002, 05:40 PM
#7
Addicted Member
Originally posted by Mc Brain
It is!!.... If you're going to use it like only once in the whole project. Even if you copy & paste that... is a pain in the a... there to look for it to copy & paste, or even re-writting the whole line multiple times. Best approach.... create a function (like I did), and add the code you like best.
Agreed. There's no performance gain in doing it either way, so a function would make more sense if for no other reason than being easier to look at.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|