Results 1 to 3 of 3

Thread: Symlink or Shortcut to file for fake Extension

  1. #1
    Join Date
    Feb 2011
    Posts
    25
    Qt products
    Qt4
    Platforms
    Windows

    Question Symlink or Shortcut to file for fake Extension

    Dear QT Developers,

    I'm not really a developer but i try to help out our developer by looking for information.

    Short explenation:
    We use a API from a different program, with this API we open a File. This API respons on the extension type from that file.
    In some cases we want to fool the program to make it think it's a different extension.
    For example movie.mov we want to open movie.fake but infact it opens that movie.mov but the API thinks it opens movie.fake
    We can not change the file extension because it's being extracted.

    I though perhaps we can create a shortcut to that file with a different extension and try to open that! I tried in windows explorer by creating a shortcut, well it did open the file but still with the same extension (even that I changed extension from the shortcut)

    Then i though about symlinking the file, so to test this i uses "mklink" in cmd/dos on windows.
    mklink /h movie.fake movie.mov
    This did work :-) but this only works on windows and needs administrator rights.


    Perhaps there is a easier way to fool a program to open a file but giving it a fake/different extension?

  2. #2
    Join Date
    Feb 2011
    Posts
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Symlink or Shortcut to file for fake Extension

    I guess this is a bit specific and difficult to do.. still i continue to search for the answer!
    If i have one i will report it here!

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Symlink or Shortcut to file for fake Extension

    The way to tackle this is to avoid relying on the API call that assumes the file extension means something. Work out what application you wish to open the file with, and launch that application passing the file name as an argument (which generally opens the document).

Similar Threads

  1. How to save project file in our own extension?
    By arunpk in forum Qt Programming
    Replies: 1
    Last Post: 22nd November 2011, 08:29
  2. QFileDialog and file extension
    By calhal in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2010, 12:54
  3. Replies: 4
    Last Post: 16th February 2010, 17:42
  4. Automatic file extension is not added to saved file on mac os x
    By sanjayshelke in forum Qt Programming
    Replies: 0
    Last Post: 30th October 2009, 06:56
  5. How to create a symlink to a directory?
    By ucomesdag in forum Qt Programming
    Replies: 4
    Last Post: 21st January 2007, 19:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.