- NSIS Discussion
- Locate plugin
Archive: Locate plugin
Instructor
30th August 2005 09:09 UTC
Locate plugin
Features:
1. Search for directories or empty directories and/or files
-search with wildcard
-search with extensions filter (include/exclude)
-search with times filter
-search with size filter
-search with attributes filter
-sort files and/or directories by name, type, size, date (with reverse or not)
-output first files or directories
-search with subdirectories or not
-search with banner support
-return path\name
-return path
-return name
-return size of file
-return date of file or directory
-return attributes of file or directory
2. Find the size of a file, files wildcard or directory (locate::GetSize)
3. Find the sum of the files, directories and subdirectories (locate::GetSize)
4. Remove empty directories and/or subdirectories (locate::RMDirEmpty)
This plugin is the replacement for Locate and GetSize functions.
"Locate" plugin v1.0
Instructor
17th September 2005 14:48 UTC
Changes:
-Option /X and /-X - Separated by "|" instead of "," (locate::Open)
-New: option /P - Additional paths to "[Path]" (locate::Open)
-New: option /-PF - Don't locate in these paths (locate::Open)
-New: option /-PN - Don't locate in these directories (locate::Open)
"Locate" plugin v1.1
Instructor
17th September 2005 19:23 UTC
Changes:
-New: options /N and /-N - names filter (locate::Open)
-Readme improvement
"Locate" plugin v1.2
mgillespie
20th November 2005 14:57 UTC
Does anyone have any example ModernUI code that uses this locate plugin?
I want to locate several files, and present the user with a way of selecing one of them.
How would I go about doing this?
Instructor
21st November 2005 14:34 UTC
Here you go. Script also using Takhir's nxs plugin
mgillespie
21st November 2005 19:00 UTC
Perfect. Thanks.
Instructor
28th November 2005 14:08 UTC
Fixed: Case sensitive sort of files and directories (if used sort by "NAME" or "TYPE"). Now case insensitive.
Fixed: Accepted only uppercased sort type "NAME|TYPE|SIZE|DATE". Now case insensitive.
"Locate" plugin v1.3
Instructor
14th December 2005 08:32 UTC
Fixed: CRT function "tolower" in StrFunc.h didn't return correct national character. "tolower", ("islower", "setlocale" ...) replaced with "CharLower" (user32.dll).
"Locate" plugin v1.4
Instructor
24th December 2005 22:21 UTC
Changed: Now plugin is msvcrt.dll independed -> work on Win95 (thanks kichik)
Updated: "ConvFunc.h" to v1.3
"Locate" plugin v1.5
Instructor
9th February 2006 11:06 UTC
Changed: Removed option "/P=", now plugin can accept multi-path in first parameter
Updated: "ConvFunc.h" to v1.5
Updated: "StrFunc.h" to v1.6
Changed: Now plugin used header "Locate.nsh" for custom user variables and
better compile errors check.
Update from previous versions:
- Insert line in script:
!include "Locate.nsh"
- Replace:
locate::Open -> ${locate::Open} ...
- Replace:
.r0 -> $0, .r1 -> $1 ... .R0 -> $R0, .R1 -> $R1 ...
"Locate" plugin v1.6
Instructor
27th May 2006 11:38 UTC
Fixed: ignore files/directories names which began with "."
Fixed: error, if file had more then 16 characters extension
Fixed: "/SF=DATE" <=> "/-SF=DATE"
Updated: "StrFunc.h" to v1.7
Updated: "StackFunc.h" to v1.9
Updated: "ConvFunc.h" to v1.7
Changed: Now if files has same date or size they sorted by name
Added: handles for search
"Locate" plugin v1.7
rxs2k5
28th May 2006 09:58 UTC
Hi instructor,
How do I use this syntax
${locate::Find} "[handle]" $var1 $var2 $var3 $var4 $var5 $var6
1. I need to find the directory or file exist in C:\Program Files\
2. I need it to change the InstallDIR or setoutpath to the found dir or file in it.
could u create a function for me to perform the task.
Instructor
1st June 2007 14:25 UTC
Fixed: locate::Open failed to open paths ended with backslash
Updated: "StrFunc.h" to v1.9
Updated: "StackFunc.h" to v2.0
Updated: "ConvFunc.h" to v2.0
"Locate" plugin v1.8
zeeh3
2nd March 2010 00:39 UTC
Hi, many of our users are having problems when NSIS uses locate plugin inside windows 7, mainly because msvcr71.dll is natively missing. Can this be fixed (removing this dependency)? Thanks.
Instructor
2nd March 2010 12:41 UTC
zeeh3
You are using self-rebuilded dll? You can check with "Dependency Walker" that plugin linked only to kernel32.dll and user32.dll.
zeeh3
2nd March 2010 16:25 UTC
Sorry, there was a mistake... my bad :)
ivansobaka
27th May 2010 12:34 UTC
Hi dear Instructor.
I have a problem during using 'locate' with Windows7 32bit
My code is following:
${locate::Open} "$0" "/F=0 /G=0" $0
StrCmp $0 0 0 loop
MessageBox MB_OK "error" IDOK close
loop:
${locate::Find} $0 $1 $2 $3 $4 $5 $6
StrCmp $1 "" close 0
IfFileExists "$1\setup.exe" 0 loop
IfFileExists "$1\config.ini" 0 loop
; do smth
goto loop
close:
${locate::Close} $0 ; at this point application going to hang up
${locate::Unload}
dean.g
11th June 2010 16:24 UTC
endless loop
Hi Instructor,
I am attempting to cycle through all subdirectories in My Documents. I have hidden directories, the first one Locate comes across is "$AVG" (hidden, readonly). This subdirectory has one subdirectory ($AVG/$CHJW) which contains four files (acgch??.dat).
Following is my open command:
${locate::Open} "$DOCUMENTS" "/F=1 /D=0 /M=*-temp-*.ppp|*Recovered*.ppp /A=-HIDDEN /B=1" $0
The find command seems to find an "endless" number of empty paths\files in the $AVG/$CHJW directory. Adding /-PN=$$AVG stops this behavour but I need this script to run on anyones computer.
Any assistance appreciated!
Instructor
14th June 2010 11:20 UTC
ivansobaka
Make sure you don't change $0 variable in "; do smth"
dean.g
I'm out of the active NSIS developing, but you can pack this folder and send me on email I will try to reproduce the bug.
ivansobaka
14th June 2010 13:03 UTC
I dont use $0 variable in "; do smth"
But I've changed following string
${locate::Close} $0
to
${locate::Close} $R1
Now it works right,
thank you very much
dean.g
14th June 2010 14:39 UTC
loop
Hi Instructor,
If you need more information please let me know.
Cheers!
Dean
dean.g
14th June 2010 14:45 UTC
loop
Hi Instructor,
Please find attached.
Instructor
14th June 2010 20:29 UTC
I'm unable to open .odt files. Lets go the other way. Try to locate in "$CHJW"
${locate::Open} "$DOCUMENTS\....\$$CHJW"
If it hang, try to remove by one file. If it not hang try to locate in "$AVG"
${locate::Open} "$DOCUMENTS\....\$$AVG"
It simply can be file system error, like bad clusters on HDD etc.
dean.g
14th June 2010 21:15 UTC
loop
Hi Instructor,
Here is contents of .odt file (open office text file). I was just showing you the directory structor.
Cheers!
Instructor
11th October 2011 13:38 UTC
Added: full unicode support on NSIS Unicode.
Locate plugin v2.0
mlf176f2
26th October 2011 23:11 UTC
Doesn't Locate All Files
For some reason this plugin cannot locate files such as
c:\.Rhistory
Is there some work-around?
Instructor
31st October 2011 15:00 UTC
mlf176f2
Is not reproduced.
FILE:"c:\IO.SYS" [110080 b] [Created: 08.06.2000 17:00:00] [-a--]
FILE:"c:\.Rhistory" [0 b] [Created: 31.10.2011 19:57:00] [-a--]
FILE:"c:\ntldr" [251152 b] [Created: 13.04.2008 18:02:06] [rahs]
tinflute
3rd May 2012 20:15 UTC
Locate crashes
My installer crashes when I run locate. It always crashes when it hits a particular folder (c:\Program Files (x86)\Oracle\). Runniny on windows 7.
${locate::Open} "C:\" `/F=1 /D=0 /X=exe /-PN="Oracle" /-PF="$WINDIR\System|$WINDIR\System32|$WINDIR\Help" /N=pg_dump.exe /B=1` $0
${locate::Find} $0 $1 $2 $3 $4 $5 $6
StrCpy $backup $0
Afrow UK
3rd May 2012 21:34 UTC
If it is reproducible how about running it through a debugger. If you are up for installing Visual Studio 2010 Express and the Windows 7 SDK then I will explain how.
Stu
tinflute
4th May 2012 14:59 UTC
ok thanks. i'll get back to you if i get that installed.
i'm looking at an another approach looking up exe path through the registry.
karlos34
15th November 2013 12:16 UTC
Hi,
I have some troubles with ${locate::Open}. I use parametr /-PF=${UpgradeExcludeDirectories} to excluding but my string of excluded files is too long and has been truncated.
I found two possible reasons:
1, I found magic constant :) in source code NSIS_MAX_STRLEN. Can you create bigger buffer please?
2, add parameter which will be able to define excluded files as relative path
Have you any idea or is exist any way how can i use relative paths for excluded files?
Many thanks guys