File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -92,17 +92,18 @@ defmodule JS2E do
92
92
93
93
@ spec create_output_dir ( list ) :: String . t ( )
94
94
defp create_output_dir ( options ) do
95
- output_path =
95
+ module_name =
96
96
if Keyword . has_key? ( options , :module_name ) do
97
97
Keyword . get ( options , :module_name )
98
98
else
99
99
"Data"
100
100
end
101
101
102
- output_path
102
+ module_name
103
+ |> String . replace ( "." , "/" )
103
104
|> File . mkdir_p! ( )
104
105
105
- output_path
106
+ module_name
106
107
end
107
108
108
109
@ spec generate ( [ String . t ( ) ] , String . t ( ) ) :: :ok
@@ -127,7 +128,15 @@ defmodule JS2E do
127
128
file_dict = printer_result . file_dict
128
129
129
130
Enum . each ( file_dict , fn { file_path , file_content } ->
130
- { :ok , file } = File . open ( file_path , [ :write ] )
131
+ normalized_file_path =
132
+ String . replace (
133
+ file_path ,
134
+ module_name ,
135
+ String . replace ( module_name , "." , "/" )
136
+ )
137
+
138
+ Logger . debug ( "Writing file '#{ file_path } '" )
139
+ { :ok , file } = File . open ( normalized_file_path , [ :write ] )
131
140
IO . binwrite ( file , file_content )
132
141
File . close ( file )
133
142
Logger . info ( "Created file '#{ file_path } '" )
You can’t perform that action at this time.
0 commit comments