Set executable bit for individual file?

Using PhpStorm - trying the 30 day eval - so far I like it, there's a few rough edges, but not as many as I run across using some of the older ide's.

One I haven't been able to figure out is how to set specific bits on a file - ex., set the executable bit on a file from within the ide or to make a file rwx by a group as opposed to just the user.

Anyone have a tip on how to do this other than to create the file, save it and then go into the filesystem and make the change?

Comment actions Permalink

Hi there,

AFAIK you cannot automatically assign custom file attributes/access rights from within PhpStorm. But you can do it semi-manually.

The workflow idea is:

  1. Create the file (in PhpStorm)
  2. Use custom action on that file ("custom action" here will be your External Tools entry)

What you will need:

  1. Create some bash/whatever script that will execute such task (set executable bit) that will take full file name as a parameter. This is optional if such command/script is very simple (sorry, I'm not Linux guy so no sure on this)
  2. Settings | External Tools -- create new entry there (the interface is easy to understand so you should have no issues here -- use "Insert macro..." button to see the list of available  macro/variables (you will need $FilePath$ one))
  3. [optional] Assign custom keyboard shortcut to such external tools entry in "Settings | Keymap | External Tools" -- now you can call this command anytime you want without using a mouse. Alternatively you can put such command on the main toolbar (Settings | Menus and Toolbars). In any case -- Edit External Tool window has check boxes that show you where this command will be available via context menus (e.g. in Editor context menu, Editor file tab, Project View etc)
  4. Start using it.
Comment actions Permalink

That solves what I'm after - somwhat.  It'll keep me off the command line, but there's a bug (already submitted) where selecting multiple resources (files in my case) the external tool only iterates over the first resource instead of repeatedly running against each selected resource.  So for me I have to right click, Make Executable (my external tool's name) for every file, one at a time.

More than 2 or 3 and I'll go back to the CLI where something like this will finish what I'm after - for foo in `ls somefiles`; do chmod +x "$foo"; done will take care of it. :)

...and yeah, I know I could probably assign -that- script to be an external tool (with some extra work), but at that point, I'm programming external tools rather than what I'm working on.

Thanks for the point in the right direction, it's sufficient and once they fix the bug it'll be even better.



Please sign in to leave a comment.