From 2138403d5ebd7e64d32391c9be45ccd4e91cdc24 Mon Sep 17 00:00:00 2001 From: Anna Date: Sat, 12 Jun 2010 17:15:18 -0400 Subject: [PATCH] Make path to wino containers user-definable --- wino | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/wino b/wino index 7b958d1..7adb483 100755 --- a/wino +++ b/wino @@ -2,14 +2,22 @@ # # wino v git # -# WINO (WINO is not an organizer is a simple script to help +# WINO (WINO is not an organizer) is a simple script to help # organize your wine installation into separate WINEPREFIX directories. # This allows you to have multiple wine "containers", or virtual Windows # installations, that are separated from each other. # See 'wino --help' for information on available options - - use strict; +use File::Path qw(make_path); + +### User-editable fields go here + +# The WINO_DIR is the directory wino will store all of its containers +# Do not include a / at the end of this, or things could break... +my $WINO_DIR = '~/.wino'; + + +### No more user-editable data below my $VERSION = "git"; my $HELP_MSG = "wino v $VERSION\n\tusage: wino --list | [options] [command]\n\n" . @@ -28,20 +36,22 @@ my $prefix = shift @ARGV; my $command = shift @ARGV; -# Check for .wino, make it if needed -if (! -d '~/.wino') { mkdir '~/.wino'; } +# Handle WINO_DIR having a ~ +$WINO_DIR =~ s/~/$ENV{'HOME'}/; + +# Check for WINO_DIR, make it if needed +unless (-d $WINO_DIR) { make_path $WINO_DIR; } -# We separate out the check for --list, since it uses $prefix and doesn't operate on a -# container +# We separate out the check for --list, since it uses $prefix and doesn't operate on a container if ($prefix eq '--list') { print "Wino Containers:\n"; # List the installed wino containers - foreach (`ls -1d ~/.wino/*`) + foreach (`ls -1 $WINO_DIR`) { - s/^.*\.wino\///; + s/^.*$WINO_DIR\///; print; } exit; @@ -49,7 +59,7 @@ if ($prefix eq '--list') # Set the container path -my $container_path = "$ENV{'HOME'}/.wino/$prefix"; +my $container_path = "$WINO_DIR/$prefix";