- PathEditor 1.0.0 - A command line utility for managing you

What it is

Anyone who’s had to update their Windows PATH variable more than once
in a week knows it’s a tiresome, error-prone, and clumsy process. This
utility aims to make it simple and easy.

Where to get it

The tool is available as a gem:

gem install patheditor

Usage

Once installed, type

path_editor

To see the current entries in your path. Options are available to add
or remove path components, or you can automatically clean duplicate
and non-existent directories.

For a listing of all options available, type:

path_editor --help

When the path is updated, all processes are notified. The current
command prompt and any future prompts launched from “Start | Run” will
have use the new setting.

Bug Reports, Feedback, etc.

The RubyForge project page hosts a forum for requesting help or
leaving feedback, and is available at:

http://rubyforge.org/projects/patheditor/

Feel free to contact me via email. I hope this tool gives all Win32
Rubyists one less complication to deal with!

Justin

Sounds very handy !
Let us know when 1.1 will be avail. I’ll be glad to help you out testing
it.

$rm rm
¿still confused?

On Feb 5, 5:17 pm, “Justin B.” [email protected] wrote:

The tool is available as a gem:
To see the current entries in your path. Options are available to add

Justin

I just installed the patheditor gem and gave it a quick test … it
failed!!!

c:\ruby>path_editor
Current path entries:
C:\Program Files\Arachno Ruby IDE\cmdline
C:\Tcl\bin
C:\Program Files\Arachno Ruby IDE\cmdline
c:\program files\graphicsmagick-1.1.7-q16
c:\program files\imagemagick-6.2.8-q16
C:\Perl\bin
C:\Program Files\Microsoft DirectX 9.0 SDK (October
2005)\Utilities\Bin\x86
C:\swig
C:\Perl\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\Program Files\ATI Technologies\ATI Control Panel
C:\p2x
C:\Program Files\Microsoft Visual Studio 8\VC\Bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft Platform SDK\Bin\win64
C:\Program Files\IDM Computer Solutions\UltraEdit-32

Note that there apparently are two C:\Perl\bin … true one there is
with C:\Perl\bin.
and two C:\Program Files\Arachno Ruby IDE\cmdline

I invoked the clean command:

c:\ruby>path_editor --clean
Removing C:\swig

NOTICE that it removed C:\swig !!! this only occurred once and
neither duplicate were deleted

c:\ruby>path_editor
Current path entries:
C:\Program Files\Arachno Ruby IDE\cmdline
C:\Tcl\bin
C:\Program Files\Arachno Ruby IDE\cmdline
c:\program files\graphicsmagick-1.1.7-q16
c:\program files\imagemagick-6.2.8-q16
C:\Perl\bin
C:\Program Files\Microsoft DirectX 9.0 SDK (October
2005)\Utilities\Bin\x86
C:\Perl\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\Program Files\ATI Technologies\ATI Control Panel
C:\p2x
C:\Program Files\Microsoft Visual Studio 8\VC\Bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft Platform SDK\Bin\win64
C:\Program Files\IDM Computer Solutions\UltraEdit-32

I was able to add C:\swig back.

c:\ruby>path_editor --remove C:\Perl\bin
Removing path C:\Perl\bin\

NOTE BUENE it removed both C:\Perl\bin\ and C:\Perl\bin

c:\ruby>path_editor
Current path entries:
C:\Program Files\Arachno Ruby IDE\cmdline
C:\Tcl\bin
C:\Program Files\Arachno Ruby IDE\cmdline
c:\program files\graphicsmagick-1.1.7-q16
c:\program files\imagemagick-6.2.8-q16
C:\Program Files\Microsoft DirectX 9.0 SDK (October
2005)\Utilities\Bin\x86
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\Program Files\ATI Technologies\ATI Control Panel
C:\p2x
C:\Program Files\Microsoft Visual Studio 8\VC\Bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft Platform SDK\Bin\win64
C:\Program Files\IDM Computer Solutions\UltraEdit-32
c:\swig

c:\ruby>path_editor --add c:\swig
Added c:\swig to path.

I tried to delete C:\Perl\bin\ — notice the last back slash

c:\ruby>path_editor
Current path entries:
C:\Program Files\Arachno Ruby IDE\cmdline
C:\Tcl\bin
C:\Program Files\Arachno Ruby IDE\cmdline
c:\program files\graphicsmagick-1.1.7-q16
c:\program files\imagemagick-6.2.8-q16
C:\Perl\bin
C:\Program Files\Microsoft DirectX 9.0 SDK (October
2005)\Utilities\Bin\x86
C:\Perl\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\Program Files\ATI Technologies\ATI Control Panel
C:\p2x
C:\Program Files\Microsoft Visual Studio 8\VC\Bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft Platform SDK\Bin\win64
C:\Program Files\IDM Computer Solutions\UltraEdit-32
c:\swig

c:\ruby>echo %PATH%
C:\Program Files\Arachno Ruby IDE\cmdline;
C:\Tcl\bin;
C:\Program Files\Arachno Ruby IDE\cmdline;
c:\program files\graphicsmagick-1.1.7-q16;
c:\program files\imagemagick-6.2.8-q16;
C:\Perl\bin;C:\Program Files\Microsoft DirectX 9.0 SDK
(October2005\Utilities\Bin\x86;
C:\swig;
C:\Perl\bin;
C:\WINDOWS\system32;
C:\WINDOWS;C:\WINDOWS\System32\Wbem;
C:\Program Files\ATI Technologies\ATI Control Panel;
C:\p2x;
C:\Program Files\Microsoft Visual Studio 8\VC\Bin;
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;
C:\Program Files\Microsoft Platform SDK\Bin\win64;
C:\Program Files\IDM Computer Solutions\UltraEdit-32;
C:\Program Files\Arachno Ruby IDE\cmdline;
G:\ruby\bin;
C:\ruby\bin;
C:\Program Files\IDM Computer Solutions\UltraCompare

NOTE BUENE path_editor failed to pick up the last 3 entries in my
%PATH% variable.

I guess that path_editor is not quite ready for prime time. It does
promise to be a handy tool…so please fix it.

It would be a nice and easy enhancement to print the reason for path
removal.

I’ve released a 1.0.1 version of the tool which fixes the issues
below. It will take a bit for it to appear on “gem update”, but it
should be there within the hour.

Also see my comments inline below.

On 2/5/07, bbiker [email protected] wrote:

c:\ruby>path_editor --clean
Removing C:\swig

NOTICE that it removed C:\swig !!! this only occurred once and
neither duplicate were deleted

Not sure why it removed C:\swig, are you sure the directory exists?

Duplicate removal should work correctly now.

NOTE BUENE path_editor failed to pick up the last 3 entries in my
%PATH% variable.

path_editor will reflect the path that comes up when you open "My
Computer | Properties | Advanced | Environment Variables " and select
the “Path” variable under “System Variables”. If you have added paths
to your local prompt (by modifying the PATH environment variable,
etc), path_editor will not see them. It works with the persisted path
that Windows stores for you.

I guess that path_editor is not quite ready for prime time. It does
promise to be a handy tool…so please fix it.

Enjoy!

On 2/7/07, Cédric Finance [email protected] wrote:

It would be a nice and easy enhancement to print the reason for path
removal.

Done! It will take an hour or so for the updated gem to appear on
RubyForge, but let me know how it works out for you.

Justin

On Feb 7, 10:54 am, “Justin B.” [email protected] wrote:

On 2/7/07, Cédric Finance [email protected] wrote:

It would be a nice and easy enhancement to print the reason for path
removal.

Done! It will take an hour or so for the updated gem to appear on
RubyForge, but let me know how it works out for you.

Justin

Just downloaded patheditor 1.0.2

You were right, I did not have a c:swig directory, so that path was
correctly removed?

Is there any for you to modify patheditor can use both the system and
user paths.
echo %path% concatenates both paths.

Possibly use a parameter which specify the path type.

path_editor --system | -s
path_editor --user | -u
if no path type specified default to system.

Some applications will by default add a path to the user’s and not to
the system’s path?

In meantime, I decided to move the one of the path from user to
system.

It worked as far as I can tell … obviously it is in the user path …
I intend to remove it

C:\Documents and Settings\Owner>path_editor
Current path entries:
C:\Tcl\bin
C:\Program Files\graphicsmagick-1.1.7-q16
C:\Program Files\imagemagick-6.2.8-q16
C:\Program Files\Microsoft DirectX 9.0 SDK (October
2005)\Utilities\Bin\x86
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\Program Files\ATI Technologies\ATI Control Panel
C:\p2x
C:\Program Files\Microsoft Visual Studio 8\VC\Bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft Platform SDK\Bin\win64
C:\Program Files\IDM Computer Solutions\UltraEdit-32
C:\Program Files\IDM Computer Solutions\UltraCompare
C:\Perl\bin
C:\ruby\bin

For test purposes, I attempted to remove the ruby path from the
system.

As you can see, it failed.

C:\Documents and Settings\Owner>path_editor --remove “C:\ruby\bin”
Removing path C:\ruby\bin
Exception: undefined method remove' for #<WindowsPathArray:0x3098b04> C:/ruby/lib/ruby/gems/1.8/gems/patheditor-1.0.2/bin/path_editor:118:in main’
C:/ruby/lib/ruby/gems/1.8/gems/commandline-0.7.10/lib/commandline/
application.rb:251:
in run' C:/ruby/lib/ruby/gems/1.8/gems/patheditor-1.0.2/bin/path_editor:172 C:/ruby/bin/path_editor:16:in load’
C:/ruby/bin/path_editor:16

On 2/10/07, bbiker [email protected] wrote:

Is there any for you to modify patheditor can use both the system and
user paths.
echo %path% concatenates both paths.

Possibly use a parameter which specify the path type.

path_editor --system | -s
path_editor --user | -u
if no path type specified default to system.

Interesting idea - I’ll keep it in mind.

For test purposes, I attempted to remove the ruby path from the
system.

As you can see, it failed.

I’ve fixed that bug and uploade a 1.0.3 release. Thanks for checking
the utility out so far!

Justin

Justin B. wrote:

NOTE BUENE path_editor failed to pick up the last 3 entries in my
%PATH% variable.

Not sure, but if you wanted the latin one, that’s “Nota Bene”.

my regards

On Feb 12, 1:14 pm, “Justin B.” [email protected] wrote:

if no path type specified default to system.

Justin

just checked out patheditor 1.0.3.

A quick check showed that --remove and --add work!!!

A wish for the next version:

The search sequence is determined by the entry order in the search
path.
It would be nice if the position of an individual path could be
moved … either before or after its current positon.

For example:

change this:

    C:\Program Files\graphicsmagick-1.1.7-q16
    C:\Program Files\imagemagick-6.2.8-q16
    C:\Program Files\Microsoft DirectX 9.0 SDK (October

2005)\Utilities\Bin\x86
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\Program Files\ATI Technologies\ATI Control Panel
C:\p2x
C:\Program Files\Microsoft Visual Studio 8\VC\Bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft Platform SDK\Bin\win64
C:\Program Files\IDM Computer Solutions\UltraEdit-32
C:\Program Files\IDM Computer Solutions\UltraCompare
C:\Perl\bin
C:\ruby\bin
C:\Program Files\Arachno Ruby IDE\cmdline
C:\Tcl\bin

    to this:

    C:\Perl\bin
    C:\ruby\bin
    C:\WINDOWS
    C:\WINDOWS\system32
    C:\WINDOWS\System32\Wbem
    C:\Program Files\Arachno Ruby IDE\cmdline
    C:\Program Files\IDM Computer Solutions\UltraEdit-32
    C:\Program Files\IDM Computer Solutions\UltraCompare
    C:\Program Files\graphicsmagick-1.1.7-q16
    C:\Program Files\imagemagick-6.2.8-q16
    C:\Program Files\ATI Technologies\ATI Control Panel
    C:\p2x
    C:\Tcl\bin
    C:\Program Files\Microsoft DirectX 9.0 SDK (October

2005)\Utilities\Bin\x86
C:\Program Files\Microsoft Visual Studio 8\VC\Bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft Platform SDK\Bin\win64

Possible scenario:

user uses path_editor to get the current path.
user edit the sequence to the order he/she wants
and pass that list to path_editor which would remove the current list
and add the new list.

I guess if remove and add could accept an array of paths that it would
work.
It would probably be best if list of paths could be stored in a file

path_editor --replace remove.lst replacement.lst

patheditor would need to check the validity of the paths in the
replacement list before it removes any path.