Fixing behaviour for existing output directories

Change-Id: Ia60b88eec53a24d2344016cd9f1dc6626f90db16
diff --git a/script/korapxml2krill b/script/korapxml2krill
index 2ac6ddb..00e9216 100644
--- a/script/korapxml2krill
+++ b/script/korapxml2krill
@@ -367,7 +367,7 @@
     my $new_out = catdir($output, get_file_name_from_glob($_));
 
     # Create new path
-    unless (make_path($new_out)) {
+    if (make_path($new_out) == 0 && !-d $new_out) {
       $log->error("Can\'t create path $new_out");
       exit(0);
     };
@@ -525,8 +525,7 @@
 sub get_file_name_from_glob ($) {
   my $glob = shift;
   $glob =~ s/\.zip$//;          # Remove file extension
-  $glob =~ s{\/([^\/]+?)$}{$1}; # Remove path unix style
-  $glob =~ s{\\([^\\]+?)$}{$1}; # Remove path windows style
+  $glob =~ s![\\\/]!-!g;        # Transform paths
   $glob =~ s/[\*\?]//g;         # Remove arbitrary fills
   $glob =~ s/[\{\}\[\]]/-/g;    # Remove class and multiple brackets
   $glob =~ s/\-\-+/-/g;         # Remove sequences of binding characters