Starting an application on linux?

7z is application

File f=File("/MEDIA/ALMACEN/APP/7z"); f.startAsProcess();

not working.

Ok, well the method would do this:

/bin/sh -c /MEDIA/ALMACEN/APP/7z

…so does that work on this very odd system of yours? (…which has a root directory called “MEDIA” in capital letters?? Sounds extremely hacky to me…)

MEDIA is a partition where Windows is installed.

You didn’t answer my question from the previous post - does that command-line work or not?

If 7z is a command program.

my code is:

String appPach="/bin/sh -c " + thisAppPach;
    SystemStats system;
    if(system.getOperatingSystemName()==T("Linux")){
     appPach<<"/7z/7z";
     appPach=appPach.replace(T(" "),T("\040"));
       }else{
    appPach<<"/7z/7z.exe";
    }
  File dirT;
    File f=File(appPach);
    String dit=ProyectoPach;
    dit<<"/make";
    dirT=File(dit);
    dirT.setAsCurrentWorkingDirectory();
   String coman="u -tzip \"" + mascota.zip + "\" *.xml *.png -r";
    f.startAsProcess(coman);

Note: my language is Spanish, spoke no English, utiliser google translator. sorry

Sorry, I’ve no idea what’s going on there. You need to debug it properly.

an example to run a program in linux, I can provide?

I asked you a question twice, and you haven’t bothered to answer it. Why would I spend any time on this if you’re not even listening to what I say?

my mistake when typing.

File f=File("/MEDIA/ALMACEN/APP/7z");
f.startAsProcess();

is

File f=File("/media/ALMACEN/app/7z");
f.startAsProcess();

but still not working

error found, the problem is when the paths have spaces (" ").

Hmm. Ok… Well, try this change in the linux file code:

bool juce_launchFile (const String& fileName, const String& parameters) { String cmdString (fileName.replace (T(" "), T("\\ "),false));

That should escape the spaces correctly.

What about quoting the path instead ? (like in sh -c “/path/to/my application with ‘quote’ and space/app”)

BTW, if you plan to escape the space, you must escape “:”, “*” et al (these chars are allowed in linux’s path).
It’s easier to escape the doublequote and to doublequote the path.

the best way is to escape with a ‘’ all potentially dangerous characters (they are numerous, ':;{}()& #' etc.. ) when you pass it to sh, otherwise you are opened to all sorts of side effects when the shell interprets the string for example if you launch an application named (xeyes) (and double-quoting does not protect you in that case).