#872 "%F" in desktop file prevents opening directories

1.2
closed-invalid
None
5
2014-05-15
2014-05-14
Sworddragon
No

I'm using PCManFM 1.2.0 and here is an example desktop file:

[Desktop Entry]
Exec=gksu pcmanfm "%F"
MimeType=inode/directory;
Name=Open as root
NoDisplay=true
Type=Application

Opening now a directory over the context menu with this entry will result that the directory can't be found (it looks like a space is added on the end causing the wrong name). Without the doublequotes all is working fine.

Discussion

  • Lonely Stranger

    Lonely Stranger - 2014-05-14

    Enclosing any expandable macros into quotes is not valid usage. Any %f or %F macro is quoted already after substitution. And especially %F one - it will be expanded into space-separated list of shell-quoted paths. You should use gksu pcmanfm %F there instead. Thank you very much.

     
  • Sworddragon

    Sworddragon - 2014-05-14

    This is interesting, as this example shows a strange behavior:

    [Desktop Entry]
    Exec=x-terminal-emulator -e /tmp/test.py %F
    MimeType=inode/directory;
    Name=Test
    NoDisplay=true
    Type=Application
    

    test.py prints just the arguments passed, expected as an array containing the executed script name and the passed arguments:

    1
    2
    3
    4
    5
    6
    7
    #!/usr/bin/python3
    # coding=utf-8
    
    import sys, time
    
    print(sys.argv)
    time.sleep(60)
    

    But testing this on the directory "/tmp/1 2" will result in the following output:

    ['/tmp/test.py', '/tmp/1', '2']
    

    This means %F was interpreted as two arguments instead of one. Using "%F" will fix the problem here and showing the wanted result:

    ['/tmp/test.py', '/tmp/1 2']
    
     
    Last edit: Sworddragon 2014-05-14
  • Lonely Stranger

    Lonely Stranger - 2014-05-14

    Oh, well, I believe if you do the same with terminals such as konsole, lilyterm, xterm, roxterm, gnome-terminal, etc. - it will show you ['/tmp/test.py', '/tmp/1 2']. And if you run it with lxterminal - you'll get ['/tmp/test.py', '/tmp/1', '2'] instead. So simply file a bug against lxterminal instead. Thank you.

    P.S. I meant your terminal in Exec key.

     
    Last edit: Lonely Stranger 2014-05-14
  • Lonely Stranger

    Lonely Stranger - 2014-05-15
    • status: open --> closed-invalid
    • assigned_to: Lonely Stranger
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks