Jump to content
  • Revista PROGRAMAR: Já está disponível a edição #60 da revista programar. Faz já o download aqui!

Sign in to follow this  
Perl

startfile() on linux

Recommended Posts

Perl

Boas,

Há algum os.startfile() para linux?!

Uma alternativa é:

import os
os.system('nautilus /home/user/path')

Fora isso, conhecem mais alguma maneira?!

Cumps

Share this post


Link to post
Share on other sites
Triton

Mas o que faz o os.startfile? ;)

Estive a procurar informação sobre isso mas não encontrei nada...


<3 life

Share this post


Link to post
Share on other sites
JoaoRodrigues
startfile(  path[' date= operation])

    Start a file with its associated application.

    When operation is not specified or 'open', this acts like double-clicking the file in Windows Explorer, or giving the file name as an argument to the start command from the interactive command shell: the file is opened with whatever application (if any) its extension is associated.

    When another operation is given, it must be a ``command verb'' that specifies what should be done with the file. Common verbs documented by Microsoft are 'print' and 'edit' (to be used on files) as well as 'explore' and 'find' (to be used on directories).

    startfile() returns as soon as the associated application is launched. There is no option to wait for the application to close, and no way to retrieve the application's exit status. The path parameter is relative to the current directory. If you want to use an absolute path, make sure the first character is not a slash ("/"); the underlying Win32 ShellExecute() function doesn't work if it is. Use the os.path.normpath() function to ensure that the path is properly encoded for Win32. Availability: Windows. New in version 2.0. New in version 2.5: The operation parameter.

Share this post


Link to post
Share on other sites
Triton

Até há pouco tempo não existia nenhum standard sobre isto para ambientes *nix, o que tornava muito difícil implementar esta funcionalidade de forma a funcionar em todos os ambientes.

Mas já existe um standard sobre isto no freedesktop.org.

Não sei se a maioria dos DE já implementaram o standard... mas penso que os mais conhecidos já tiram partido deste.


<3 life

Share this post


Link to post
Share on other sites
djthyrax

Grande digg. Havia um conjunto de tools para isso, o Triton falou-me delas quando ele estava no BlackBox.


Não peças ajuda por PM! A tua dúvida vai ter menos atenção do que se for postada na secção correcta do fórum!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.