Also for filename and subdir Resolved

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Also for filename and subdir Resolved

Post by Silvio.Falconi »

I have a file image on

cPathMask:="C:\Work\Prg\WinBeach\bitmaps\servizi\pattino.png"

the image is pattino.png

I wish save on record (dbf) only bitmaps\servizi\pattino.png

I saw also filename.prg and not found a solution

Function test()

Local cIniFile := cFilePath( GetModuleFileName( GetInstance() ) ) + "Test.ini"
Local cExePath := cFilePath( GetModuleFileName( GetInstance() ) )

Local cSerPath := GetIni( cIniFile, "Config", "Ser", cExePath+"bitmaps"+"\servizi\")
Local cPathMask:="C:\Work\Prg\WinBeach\bitmaps\servizi\pattino.png"
Local only_Image := cFileNoPath( cPathMask )
? only_Image
nSTART := RAT( "\", only_Image )
?SUBSTR(cPathMask,1,nSTART-1)
any solution please
Last edited by Silvio.Falconi on Tue Mar 17, 2020 9:32 am, edited 1 time in total.
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Also for filename and subdir

Post by cnavarro »

Excuse me, I don't understand what you need
I attach some code

Code: Select all

Function Main()
Local cIniFile := cFilePath( GetModuleFileName( GetInstance() ) ) + "Test.ini"
Local cExePath := cFilePath( hb_Argv(0)  ) //cFilePath( GetModuleFileName( GetInstance() ) )
Local nStART
//Local cSerPath := GetIni( cIniFile, "Config", "Ser", cExePath+"bitmaps"+"\servizi\")
Local cPathMask:="C:\Work\Prg\WinBeach\bitmaps\servizi\pattino.png"
Local only_Image := cFileNoPath( cPathMask )
? cExePath
? only_Image
//nSTART := RAT( "\", only_Image )    // If you apply cFileNoPath to cPathMask, it is impossible obtain any "\"
nSTART := RAT( "\", cPathMask )
? SUBSTR( cPathMask, 1, nSTART - 1 ), cFilePAth( cPathMask )
Return nil


C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Also for filename and subdir

Post by Silvio.Falconi »

I need it return me " .\bitmaps\servizi\pattino.png"

I wish erase cExePath from "C:\Work\Prg\WinBeach\bitmaps\servizi\pattino.png"
cEXePath is "C:\Work\Prg\WinBeach\"
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Also for filename and subdir

Post by cnavarro »

Silvio.Falconi wrote:I need it return me " .\bitmaps\servizi\pattino.png"

I wish erase cExePath from "C:\Work\Prg\WinBeach\bitmaps\servizi\pattino.png"
cEXePath is "C:\Work\Prg\WinBeach\"
Then

Code: Select all

? StrTran( "C:\Work\Prg\WinBeach\bitmaps\servizi\pattino.png", cExePath, "" )
 
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Also for filename and subdir

Post by Silvio.Falconi »

Nice!
Thanks
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply