Changes between Initial Version and Version 1 of Ticket #111, comment 4


Ignore:
Timestamp:
Apr 1, 2016, 4:46:56 AM (9 years ago)
Author:
EdT

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #111, comment 4

    initial v1  
    1 s10k
    2 
    3 I use this code:
    4 
    5 on convert_path_to_UNIX(raw_path_name)
    6         set safe_path_name to ""
    7         set found_colon to false
    8         set first_colon to 1
    9         set escape_list to {" ", "'", "(", ")","%2F"} -- add any other char.s that need escaping here
    10         set colon to ":" -- gets changed to forward-slash if present
    11         set num_escapes to count of escape_list
    12         set num_char to count of characters in raw_path_name
    13         set found_colon to false
    14         repeat with x from first_colon to num_char -- start after hard drive's name
    15                 if (character x in raw_path_name is colon) then
    16                         set safe_path_name to safe_path_name & "/"
    17                         set found_colon to true
    18                 else
    19                         repeat with y from 1 to num_escapes
    20                                 if (character x in raw_path_name is (item y of escape_list)) then
    21                                         set safe_path_name to safe_path_name & "\\"
    22                                 end if
    23                         end repeat
    24                 end if 
    25                 if (found_colon is false) then
    26                         set safe_path_name to safe_path_name & character x in raw_path_name
    27                 else
    28                         set found_colon to false
    29                 end if
    30         end repeat     
    31         return safe_path_name
    32 end convert_path_to_UNIX
    33 
    34 Iritscen: Did you write this code for me?
     1Edit: Ignore this comment I need to double check my code.