Skip to content

Commit 4cfc5d3

Browse files
author
x02lucpo
committed
fixed a bug in load_file. Under windows the loading of packages could not handle filenames with "/" only with "\"
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2294 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent b38a5be commit 4cfc5d3

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

Compiler/Util.rml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,20 @@ relation tick_str:() => string =
17681768
tick_str() => s
17691769
end
17701770

1771+
(** relation replace_slash_with_path_delimiter
1772+
** author: x02lucpo
1773+
**
1774+
** replace the "/" with the system-pathdelimiter.
1775+
** On window must be \ so that the get_absolute_directory_and_file works
1776+
**)
1777+
relation replace_slash_with_path_delimiter:(string) => string =
1778+
1779+
rule System.pathDelimiter() => pd &
1780+
System.stringReplace(str,"/",pd) => ret_string
1781+
-----------------------------
1782+
replace_slash_with_path_delimiter(str) => ret_string
1783+
end
1784+
17711785
(** relation get_absolute_directory_and_file
17721786
** author: x02lucpo
17731787
**
@@ -1778,15 +1792,17 @@ end
17781792

17791793
relation get_absolute_directory_and_file:(string) => (string,string) =
17801794

1781-
rule System.pathDelimiter() => pd &
1795+
rule replace_slash_with_path_delimiter(file') => file &
1796+
System.pathDelimiter() => pd &
17821797
string_list(pd) => pd_chr::[] &
17831798
(*same dir only filename as param*)
17841799
string_split_at_char(file,pd_chr) => list_path::[] &
17851800
System.pwd() => res
17861801
-------------------------
1787-
get_absolute_directory_and_file(file) => (res,list_path)
1802+
get_absolute_directory_and_file(file') => (res,list_path)
17881803

1789-
rule System.pathDelimiter() => pd &
1804+
rule replace_slash_with_path_delimiter(file') => file &
1805+
System.pathDelimiter() => pd &
17901806
string_list(pd) => pd_chr::[] &
17911807
string_split_at_char(file,pd_chr) => list_path &
17921808
list_last(list_path) => file_path &
@@ -1798,7 +1814,7 @@ relation get_absolute_directory_and_file:(string) => (string,string) =
17981814
System.pwd() => res &
17991815
System.cd(current_dir) => 0
18001816
-------------------------
1801-
get_absolute_directory_and_file(file) => (res,file_path)
1817+
get_absolute_directory_and_file(file') => (res,file_path)
18021818

18031819
rule Debug.fprint("failtrace", "-get_absolute_directory_and_file failed")
18041820
-------------------------

0 commit comments

Comments
 (0)