Page 1 of 1

Replace Path

PostPosted: Sat Apr 09, 2016 3:57 am
by StarterPack
Hi Guys, When I build my program i used a path (example) !C:\My Program.... etc to read and write files, because i've tested it everytime.
Now i want to compile the program. How do i replace all my paths with [SrchDir]
Thank You

Re: Replace Path

PostPosted: Sat Apr 09, 2016 5:29 am
by Gaev
StarterPack:

Instead of using absolute path references, you can use relative path references ... from the Help file ...

[PubDir] The folder where the publication EXE resides.

... so you can code something like ...
Code: Select all
FileRead "![PubDir]somefile.dat" "All" "[someVariable]"
or
FileRead "![PubDir]someSubFolder\somefile.dat" "All" "[someVariable]"


This way, you never have to change file references ... just make sure the data files are located in the same relative position to the pub/exe file.

Re: Replace Path

PostPosted: Sat Apr 09, 2016 6:25 am
by StarterPack
Hi Gaev

So I guess there's no other way but to enter all my paths manually? Thanks for the advice.

Re: Replace Path

PostPosted: Sat Apr 09, 2016 7:03 am
by Cipolla
There is still another way ;)

1. Please make a backup of your pub file.
2. Open your pub file in windows editor
3. do a ctrl+h to find & replace text
4. simply replace all absolute path references (i.e. "!C:\My Program...." with [SrchDir] or [PubDir] like GAEV mentioned
5. save all and reopen in Neobook

Re: Replace Path

PostPosted: Sun Apr 10, 2016 1:43 am
by StarterPack
Hi Cipolla

Thank You!!! This will save me lots of time