[4.20] Bug or Problem code ?

Linux specific forum
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

[4.20] Bug or Problem code ?

Post by Progi1984 »

Hello

I try to create an archive (.a) from objects files (.o).

No problem in command line. But when i use RunProgram, no archive files generated.

The code and O files are in the zip...
File:1->Test_AR.zip
Image

Code: Select all

    StringTmp.s = "rvs "
    StringTmp + chr(34) + "/home/franklin/Bureau/DD_PureBasic/Test.a"+ chr(34) + " "
    StringTmp + "/home/franklin/Bureau/DD_PureBasic/*.o"
    Debug StringTmp
    RunProgram("ar ", StringTmp, "", #PB_Program_Wait)
Thanks in advance for your help.
Fred
Administrator
Administrator
Posts: 18171
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I don't think than runprogram() support '*.o' as this pattern is typically extended by the shell interpreter.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Yes, RunProgram() does not expand these.

You can try with system_(), it calls a shell, so this should work (also > and < redirection)
http://www.gnu.org/software/libc/manual ... ystem-3150
quidquid Latine dictum sit altum videtur
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

May be a feature request for a next version ? :)
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

Finally, just a last question, how can i get the directory of pb under Linux ?

I try :
- system_(@"which pbcompiler")
- RunProgram("which", "pbcompiler")
- RunProgram("which pbcompiler")

But no returns...
Have you got an idea ?
Fred
Administrator
Administrator
Posts: 18171
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

It's probably not in you PATH variable. There is no way to detect it automatically, but you can define a PUREBASIC_HOME env var and use this value in your programs.
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

But when I make a which pbcompiler, this returns that :

Code: Select all

franklin@novatux-laptop:~$ which pbcompiler
/media/DISK/Programs/purebasic/compilers/pbcompiler
Have you got a solution for getting the return of system_(@"which pbcompiler") ?
Fred
Administrator
Administrator
Posts: 18171
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

When you use this:

Code: Select all

RunProgram("which", "pbcompiler") 
Did you tried with the #PB_Program_Read flags and ReadProgramString() command ?
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

I tried this code :

Code: Select all

  Compilateur = RunProgram("which", "pbcompiler ", "", #PB_Program_Open|#PB_Program_Read)
  Sortie$ = ""
  If Compilateur 
    While ProgramRunning(Compilateur)
      Sortie$ + ReadProgramString(Compilateur) + Chr(13)
    Wend
    Sortie$ + Chr(13) + Chr(13)
    Sortie$ + "Code de retour : " + Str(ProgramExitCode(Compilateur))
  EndIf
  MessageRequester("Sortie", Sortie$)
And Sortie$ returns ""
Fred
Administrator
Administrator
Posts: 18171
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

is space in "pbcompiler> <" intentional ? Are you executing your pogram from the same shell which show an output with 'which' ?
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

No, but that doesn't change anything.
User avatar
flaith
Enthusiast
Enthusiast
Posts: 704
Joined: Mon Apr 25, 2005 9:28 pm
Location: $300:20 58 FC 60 - Rennes
Contact:

Post by flaith »

have you tried with another program ? Same issue ?
“Fear is a reaction. Courage is a decision.” - WC
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

For RunProgram, yes, with "ar" !
User avatar
flaith
Enthusiast
Enthusiast
Posts: 704
Joined: Mon Apr 25, 2005 9:28 pm
Location: $300:20 58 FC 60 - Rennes
Contact:

Post by flaith »

Progi1984 wrote:For RunProgram, yes, with "ar" !
:oops: forgot your first post :lol:

with a "which -a pbcompiler", what does it gives you ?
“Fear is a reaction. Courage is a decision.” - WC
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

Code: Select all

  Compilateur = RunProgram("which", "-a pbcompiler", "", #PB_Program_Open|#PB_Program_Read)
  Sortie$ = ""
  If Compilateur 
    While ProgramRunning(Compilateur)
      Sortie$ + ReadProgramString(Compilateur) + Chr(13)
    Wend
    Sortie$ + Chr(13) + Chr(13)
    Sortie$ + "Code de retour : " + Str(ProgramExitCode(Compilateur))
  EndIf
  MessageRequester("Sortie", Sortie$)
Negative, returns an empty string.
Post Reply