Enable file deletion in Ruby script

I am creating a small ruby ​​script to resize images and save them in the specified directory. I would like the application to be as transparent as possible.

Can I allow file deletion on my Ruby script on all platforms? For example, a user drags a file onto a script, which then takes the file path as an argument and resizes the image accordingly - there is no graphical interface, no console, etc.

+3
source share
4 answers

Drag and drop behavior is OS dependent (and in the case of Linux window manager), so no.

Windows . .rb, , , script.

Windows HKLM\Software\Classes *.jpg\myhandler\command , Windows ( jpg , script ).

Linux, , . , ( ,...), , .desktop, . http://standards.freedesktop.org/desktop-entry-spec/latest/ ~/Desktop/*.

+5

, windowsusers . .reg , , Windows Vista 7

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\rbfile\ShellEx\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"

[HKEY_CLASSES_ROOT\rbwfile\ShellEx\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"

[HKEY_CLASSES_ROOT\RubyFile\ShellEx\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"

[HKEY_CLASSES_ROOT\RubyWFile\ShellEx\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"
+2

, , , .

, : , .

+1

You can use platypus on os x to create a wrapper around your script.

http://sveinbjorn.org/platypus

Regards Klaus

+1
source

Source: https://habr.com/ru/post/1713092/


All Articles