Also for filename and subdir Resolved

Also for filename and subdir Resolved

Postby Silvio.Falconi » Sun Mar 15, 2020 5:27 pm

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.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7053
Joined: Thu Oct 18, 2012 7:17 pm

Re: Also for filename and subdir

Postby cnavarro » Sun Mar 15, 2020 11:20 pm

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

Code: Select all  Expand view

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


Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Also for filename and subdir

Postby Silvio.Falconi » Mon Mar 16, 2020 12:06 pm

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\"
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7053
Joined: Thu Oct 18, 2012 7:17 pm

Re: Also for filename and subdir

Postby cnavarro » Mon Mar 16, 2020 1:26 pm

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  Expand view

? StrTran( "C:\Work\Prg\WinBeach\bitmaps\servizi\pattino.png", cExePath, "" )
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Also for filename and subdir

Postby Silvio.Falconi » Mon Mar 16, 2020 7:07 pm

Nice!
Thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7053
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests