Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8188397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:53:51+00:00 2026-06-07T02:53:51+00:00

I created a simple program that takes the path of a directory as an

  • 0

I created a simple program that takes the path of a directory as an input, creates an archive of that directory (converting it into a single file), adds a shebang to that file (so that the contents of the file can be easily extracted), and writes the file to the base directory of the specified path.

The problem is that the file does not extract itself when I double click on it. Instead the operating system (I’m using Ubuntu 11.10) tries to open it with gedit. This obviously shows the shebang, random gibberish, and the contents of the archived files.

I made the file executable, first by using chmod +x; and when it still didn’t work I tried chmod 777. However it still refuses to execute the file with the shebang when I double click on it. Perhaps this is because it’s not a pure text file.

Interestingly when I try to execute the file directly from command line it reads the shebang and extracts the contents of the archive properly. So there’s nothing wrong with my file format. I don’t know much about what operating systems do when you double click on a file but I would sure like to understand.

It surely makes no sense to add a shebang to a file if you still need to manually execute it from the command line. One advantage could be that you don’t need to specify the program to open it with but I believe that’s hardly an advantage. Any help will be greatly appreciated.

Update 1:

The program that creates the archive is called opm. It can be installed via the node package manager using the following command:

npm install opm

After that you simply use opm to pack and unpack directories for you. For example if I have a directory called test in my home directory then I can open a terminal and execute the following command to pack it:

opm test

This will create an archive of the directory called test.pack in the home directory. The .pack file has the shebang #!/usr/bin/opm. Opening a file with the extension .pack with opm tells it that it’s an archive and opm unpacks it in the same directory.

Note: Change the name of the test.pack file if you do not want it to overwrite your existing test directory.

I added the shebang to the .pack file so that it would extract itself when I opened it. However that doesn’t seem to work. Nevertheless if I run one of the following command then it works:

./test.pack

You may check my source code and make any modifications to the program as you may wish to.

Update 2:

Alright I created the following .desktop file for opm and stored it in the $HOME/.local/share/applications/ directory:

[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
Name=OPM
GenericName=Object Packer and Minifier
NoDisplay=true
Comment=JavaScript Package Manager
TryExec=opm
Exec=opm %f
Terminal=false
MimeType=application/opm

Now I was able to associate .pack files with opm by right clicking on a .pack file, going to the Properties window, the Open With tab, and setting opm.desktop as the default application. Now I am able to unpack a .pack file by simply opening it.

However I would like to know how to associate .pack files with the mime type application/opm. Currently the .pack files are associated with application/x-java-pack200. How do I do so? Is it better if I use a different extension (e.g. .opm)? By associating the packed archives with the mime type application/opm will the OS open them with opm by default without having to explicitly set a default application from Properties > Open With?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:53:54+00:00Added an answer on June 7, 2026 at 2:53 am

    If there’s already a MIME-type associated with .pack then you’ll want to use a different extension (.opm) to associate with your MIME-type (application/opm). The way you automatically associate a program that opens files of a specific MIME-type is with xdg-mime .

    Alternatively,

    • Edit ~/.local/share/applications/mimeapps.list and put your MIME/application combo under [Default Applications] like so:
    [Default Applications]
    application/opm=opm.desktop;
    
    • Place your opm.desktop file in ~/.local/share/applications/ folder. (You’ve already done this)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking for help on writing a Perl program that takes an input file and
I have created this program that takes two inputs and prints them out (simple,
I have a simple program that creates a thread, loops twenty times and then
I'm working on a simple program that collects and checks user-input. In addition to
I am currently writing a program which takes user input and creates rows of
Im trying to write a simple program that takes 5 images and allows you
I am attempting to create a simple program that will keep a text log
I want to create an extremely simple iPhone program that will open a telnet
I am trying to create a program that will do some simple calculations, but
I have created this simple program to learn shared_ptr using namespace std; #define Yes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.