#!/usr/bin/perl

my @args;

#push @args, ("strace", "-v", "-o", "/tmp/strace.log");

push @args, ("/usr/bin/wine", $0 . ".exe");

my $used = 0;

foreach (@ARGV) {
	if ($used and m!/(?:home|mnt|tmp)/!) {
		m!(/(?:home|mnt|tmp)/[^"]*)!;
		my $pre = $`;
		my $post = $';
		my $match = `winepath -w -- $1`;
		$match =~ s!\n$!!;
		$_ = $pre . $match . $post;
	}
	push @args, $_;
	$used = 1;
}

#print join(' ', @args);

exec {$args[0]} @args;

die "Failed to run " . join(' ', @args) . "\n\t$?";
