GetFilePartWE

TailBite specific forum

Moderators: gnozal, ABBKlaus, lexvictory

User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

GetFilePartWE

Post by Droopy »

Hello,

Code: Select all

ProcedureDLL.s GetFilePartWE(file.s) ; Return only file part without extension
  
  file.s=ReverseString(GetFilePart(file))
  file=Right(file,Len(file)-FindString(file,".",1))
  file=ReverseString(file)
  ProcedureReturn file

EndProcedure
Test :

Code: Select all

Debug GetFilePartWE(ProgramFilename())
The function return Purebasic1
With Tailbite 1.4.7 the function return : C:\Users\descaves\AppData\Local\Temp\Purebasic1.exePurebasic1

Any idea ?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: GetFilePartWE

Post by gnozal »

Iirc it's a known Tailbite issue with string returning functions when used as procedure parameters.

I guess this code works ?

Code: Select all

Tmp.s = ProgramFilename()
Debug GetFilePartWE(Tmp)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: GetFilePartWE

Post by Droopy »

Hello Gnozal.

I know a function wich return string can't call another function wich return string.
But i call GetProgramFilename() wich is an internal function.

Your solution works.
My old lib (Purebasic 3.94) works well with this function.

Could this bug be fixed ?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: GetFilePartWE

Post by gnozal »

I guess it's related to the other string issues.

It probably could be fixed but I am no asm guru.
And the fix should only be applied if a function was used as string parameter.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: GetFilePartWE

Post by Droopy »

Code: Select all

ProcedureDLL.s Test(file.s)
  ProcedureReturn
EndProcedure
Compiled and tested with MessageRequester("",Test(ProgramFilename()))
return C:\Users\descaves\AppData\Local\Temp\Purebasic1.exe
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: GetFilePartWE

Post by Droopy »

Is it possible to create a topic for asm guru to fix this bug ?
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Re: GetFilePartWE

Post by lexvictory »

I don't know that it can be fixed; string handling is done differently in PB made functions than it is in C - at least from what I can tell by the example sources in C

I might take a look when I get the time, but if someone can figure out the cause of it I might be able to write a quick fix...

I may have thought of a solution to calling another TB string function from a TB procedure, but we'll see how that works...
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
Post Reply