AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FileExist in path environment
Goto page Previous  1, 2
 
Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Thu Aug 30, 2007 2:17 pm    Post subject: Reply with quote

Andreone wrote:
Actually, c:\\ or c:\\dir\file are still valid paths. However, I understand it can be seen as dirty.


Honestly, I thought a little more than of cosmetic value, like it could create some problems in specific situations:

Code:
hModule := DllCall( "LoadLibrary", Str,WhereIs("MyThirdParty.DLL") )


Well! It works fine with double slash! Still, I prefer the function to conform to regular standard.

Quote:
During testing, I felt that msgboxes appeared faster when not calling PathAddBackslashA.


Oh! I will also experiment with RegEx ( I remember PhiLho giving me one )

Smile
Back to top
View user's profile Send private message
tic



Joined: 22 Apr 2007
Posts: 1502

PostPosted: Thu Aug 30, 2007 2:33 pm    Post subject: Reply with quote

Code:
StringRight, CheckLastSlashSource, Source, 1
If CheckLastSlashSource = \
StringTrimRight, Source, Source, 1


Question
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Thu Aug 30, 2007 2:38 pm    Post subject: Reply with quote

@tic: I know as that is the documented method. Smile
Back to top
View user's profile Send private message
tic



Joined: 22 Apr 2007
Posts: 1502

PostPosted: Thu Aug 30, 2007 2:49 pm    Post subject: Reply with quote

Razz sorry! was just wondering what all the commotion was about
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Thu Aug 30, 2007 3:47 pm    Post subject: Reply with quote

tic wrote:
wondering what all the commotion was about


We were tinkering a good idea and hence the commotion. Very Happy

Anyways, here is a shortened version:

Code:
WhereIs( File ) {
 SplitPath, A_AhkPath,, A_AhkDir
 EnvGet, Dos, Path
 sPath=%A_WorkingDir%;%A_ScriptDir%;%A_AhkDir%;%A_AhkDir%\Lib;%A_MyDocuments%\AutoHotkey\Lib;%Dos%
 Loop, Parse, sPath, `;
     IfNotEqual, A_LoopField,, IfExist, %A_LoopField%\%File%
         Return, RegExReplace( A_LoopField "\" File,  "\\\\", "\" )
 RegRead, AppPath, HKLM, SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\%File%
 IfExist, %AppPath%, Return, AppPath
}


Credit: I borrowed the function name and the Registry path from this <external link>

Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group