Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I am using :
I have a search.pro file and I specified its location with the search_path_file option in the config.pro file.
My issue is that when the search.pro file is located in a shared drive the paths contained in it are not loaded, The search.pro file location on windows look like this :
G:\.shortcut-targets-by-id\1-Ry9DYQu4fjLV_e7jmMnEONCEw71CKav\Shared_folder\02_R&D\Parts & Drawings\search_file_location
I have a bat file build_search_paths.bat that automatically builds the search.pro file with the folders and subfolders next to it, the content is the following :
@echo off
setlocal enabledelayedexpansion
set "OutputFile=search.pro"
if exist "%OutputFile%" del "%OutputFile%"
for /r %%i in (.) do (
set "dirPath=%%i"
set "dirPath=!dirPath:\.=!"
echo "!dirPath!" >> "%OutputFile%"
)
echo Done! Directory paths have been written to "%OutputFile%"
endlocal
My solution for now is to have a "Personal_lib" folder in my creo startup directory where i copy all the folders and subfolders from the drive that i need to load in creo and build the seach.pro file with my bat file in this "Personal lib" folder. This works but this would be super great if it worked directly on the folders from google drive.
I don't even know exactly where the problem is, I have some ideas :
Solved! Go to Solution.
I would recommend the following:
Regards,
Dan N.
I've not used Google drive for file storage - our IT folk 100% prohibit us from doing things like that.
The method I use to build my search paths for a particular project is detailed here:
My batch file that builds the path file is a bit more elaborate than yours - I needed to expand the directory from its mapped designation, for example, to make the paths work for anyone, regardless of what letter they have a particular location mapped to.
I have had some tricky difficulties in the past with directory names that contain things like "&" and other special characters. Mostly these troubles were with the batch file, not with Creo. The batch file would produce weird wrong results.
Are the paths you are specifying in your search.pro (or whatever it's called) enclosed in quotes? Maybe a dumb question, but I have to ask.
Also, I think there is some sort of total character limit for a path designation. Maybe something like 256 characters? Some people I work with like to use very long sentences for directory specifications, things like "New Design - use this one but not the Old Ones 2023-01-01 (Ask Fred)". Argh.
One of the troubles with this stuff is it's hard to know what is currently set for the search path. I don't really know if you can query just what is defined for a session. So, you can't actually see what paths are not included, making it harder to debug.
Unfortunatly we use google drive for our small startup for now even if I agree it's not ideal.
I had some trouble also with special characters in bat files but now the one that i have dosn't seem to have any problem with it. The paths created are indeed enclosed in "" and they seem fine. The longest is 234 characters so it should also be fine.
I don't know neither how to know exactly what paths have been loaded or tried to be loaded by creo and failed.
I have tried your bat file, it didn't work, the output is this :
Le chemin d’accès spécifié est introuvable.
Le chemin d’accès spécifié est introuvable.
'drawings""' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
It's in french, the translation is :
The specified path could not be found.
The specified path could not be found.
'drawings""' is not recognized as an internal or external command, an executable program, or a batch file.
I don't know exactly which line is it coming from ?
Just to be sure, I might have made changes to my batch file in the time since that message was written. Here's the current version:
::
:: Builds two files for use with Creo:
:: locconfg.pro = A short version of a config.pro file, which adds a
:: specification of a search path file to what is already
:: defined in the user's session.
:: locsrch.pro = A list of directory specifications that are to be
:: appended to the user's already defined list of paths.
:: The purpose of these two files is to modify the search path for a specific
:: session so the user is able to find files that are in subdirectories of
:: a particular project directory.
::
:: Author: Kenneth J. Farley
:: Date: 2018-02-06
::
@ECHO OFF
setlocal EnableDelayedExpansion
::
:: Define the names of the files to be created.
::
set filConfg=locconfg.pro
set filPaths=locsrch.pro
set filExtra=external.pth
::
:: Determine if this batch file is being run on a local drive, or on a
:: network shared drive, and set a variable indicating as such.
::
set drvIsNet=0
IF "%~d0" == "\\" (
set drvIsNet=1
) ELSE (
FOR /F "tokens=2" %%a IN ('net use ^| findstr /r /c:" [A-Z]: "') DO (
IF "%%a" == "%~d0" SET drvIsNet=1
)
)
::
:: Build the local search path file so it reflects the current directory
:: structure, overwriting any existing file. Note that double quotes
:: are output around each path specification to allow for the possibility of
:: spaces or other characters that Creo doesn't handle well.
::
:: If there are other paths that the user wishes to include that are not
:: subdirectories of the current directory, they may be listed in a file
:: named by the variable filExtra. The contents of this file will be
:: appended onto the end of the local search file. The format of the
:: contents of this file is not checked for validity.
::
ECHO. >NUL 2> %filPaths%
call :doPath "%CD%"
ECHO "!absName!" >> %filPaths%
FOR /R /D %%d IN ("*") DO (
call :doPath "%%d"
ECHO "!absName!" >> %filPaths%
)
IF EXIST "%filExtra%" TYPE "%filExtra%" >> %filPaths%
::
:: Build the config file, including the user's name, the current date, some
:: comments explaining the usage, and the one search path setting.
::
ECHO. >NUL 2> %filConfg%
ECHO ^^! > %filConfg%
ECHO ^^! Local version of config.pro, built automatically. Load >> %filConfg%
ECHO ^^! this file into your Creo session via the following: >> %filConfg%
ECHO ^^! File-^>Options-^>Configuration Editor-^>Import/Export >> %filConfg%
ECHO ^^! >> %filConfg%
ECHO ^^! Author : %username% >> %filConfg%
ECHO ^^! Date : %date% >> %filConfg%
ECHO ^^! >> %filConfg%
CALL :doPath "%CD%"
set absName=%absName:"=%
::"
ECHO search_path_file !absName!\%filPaths% >> %filConfg%
exit /b
::
:: The variable "drvIsNet", set at the beginning of this batch file,
:: indicates if this is a mapped network drive or not. If it is, we
:: want to expand the <letter>: expression to the absolute network
:: path, so the search and config files will be universal, working the
:: same for anyone using them. For example, user A might have a particular
:: drive mapped to "Q:", while user B has "P:". Using an absolute path
:: eliminates any concerns about this mapping difference.
::
:doPath
set "dirName=%1"
IF !drvIsNet! == 1 (
set mapName=%dirName:~1,2%
set dirName=%dirName:~3,-1%
FOR /f "tokens=3" %%a in ('net use !mapName! ^| Find "Remote name"') DO set uncPath=%%a
set "absName=!uncPath!!dirName!"
) ELSE (
set absName=%dirName:"=%
)
exit /b
If you are having troubles and want to debug, you have to turn off the "@ECHO OFF" line by putting any number of colons ":" at the start of the line. Then when you run it it will show every command as it is executed. Judging from the output you gave it would seem that something is going wrong with the way it is parsing the directories.
Maybe there is trouble with the way I'm expanding the path designations to get the full network path? The "drvIsNet" related commands? I have only ever run the batch file on network drives, not on something like Google drive. Maybe it's having trouble doing that stuff?
If you allow the batch file to echo its commands, you might be able to located where the problem is starting. That's another joy of batch files, once it starts going wrong, it really fails completely.
I would recommend the following:
Regards,
Dan N.
So I did the "MKLINK" Option and ran again my bat file, it works now perfectly, I do think there was a problem with the "&" in the path names.
I mapped
G:\.shortcut-targets-by-id\1-Ry9DYQu4fjLV_e7jmMnEONCEw71CKav\Shared_folder\02_R&D\Parts & Drawings project1
to
C:\Creo\Shared_libs\project1
and i ran the bat file at this location.
I tried debugging the bat file from @KenFarley it does seem that the error I had was coming from the "&" also but too hard and long to debug.
Thanks a lot ! I hope it can help other small businesses that also uses Google drive.
Hi,
in default Creo config.pro file I can see following option
search_path_file $CREO_COMMON_FILES\ifx\parts\prolibrary\search.pro
This means that the value contains path and also search.pro filename.
What does your config.pro option look like?
My config option had the path and search.pro filename the problem was not coming from here. Now that it is working the config.pro option looks like this :
search_path_file C:\Creo\Shared_libs\project1\search_project1.pro