2525require_relative "../lib/sonicpi/lang/sound"
2626require_relative "../lib/sonicpi/lang/minecraftpi"
2727require_relative "../lib/sonicpi/lang/midi"
28+ require_relative '../paths'
2829require 'active_support/inflector'
2930require 'erb'
3031require 'gettext'
3132require "gettext/tools/xgettext"
3233
33-
3434class QtDocs
3535 include SonicPi ::Lang ::Support ::DocSystem
3636 include SonicPi ::Util
@@ -72,9 +72,10 @@ def generate_docs
7272
7373 def generate_pot_file ( interpolated_file_paths )
7474 puts 'Extracting the translatable text into pot file...'
75- FileUtils . mkdir_p ( interpolated_template_path ) unless File . exist? ( interpolated_template_path )
75+ FileUtils . mkdir_p ( :: SonicPi :: Paths . interpolated_template_path ) unless File . exist? ( :: SonicPi :: Paths . interpolated_template_path )
7676 cwd = Dir . pwd
77- Dir . chdir ( generated_path )
77+ FileUtils . mkdir_p ( ::SonicPi ::Paths . generated_path ) unless File . exist? ( ::SonicPi ::Paths . generated_path )
78+ Dir . chdir ( ::SonicPi ::Paths . generated_path )
7879 GetText ::Tools ::XGetText . run (
7980 *interpolated_file_paths ,
8081 '-otest.pot'
@@ -89,6 +90,7 @@ def generate_toml_files
8990 key = key . to_s [ 3 ..-1 ] if collection [ :klass ] == SonicPi ::Synths ::FXInfo
9091 interpolated_file = File . read ( "#{ collection [ :interpolated_path ] } /#{ key } .toml.erb" )
9192 output = ERB . new ( interpolated_file , nil , '-' ) . result ( binding )
93+ FileUtils . mkdir_p ( collection [ :output_path ] ) unless File . exist? ( collection [ :output_path ] )
9294 File . open ( "#{ collection [ :output_path ] } /#{ key } .toml" , 'w' ) do |f |
9395 f . write output
9496 end
@@ -98,7 +100,7 @@ def generate_toml_files
98100
99101 def sync_to_documentation_app
100102 puts 'Syncing the TOML files to the documentation web app...'
101- FileUtils . cp_r ( doc_toml_path , documentation_app_priv_path , remove_destination : true )
103+ FileUtils . cp_r ( :: SonicPi :: Paths . doc_toml_path , :: SonicPi :: Paths . documentation_app_priv_path , remove_destination : true )
102104 end
103105
104106 def synths
@@ -107,9 +109,9 @@ def synths
107109 end
108110 {
109111 items : items ,
110- template_path : synth_and_fx_template_path ,
111- interpolated_path : synths_interpolated_path ,
112- output_path : synths_toml_path ,
112+ template_path : :: SonicPi :: Paths . synth_and_fx_template_path ,
113+ interpolated_path : :: SonicPi :: Paths . synths_interpolated_path ,
114+ output_path : :: SonicPi :: Paths . synths_toml_path ,
113115 klass : SonicPi ::Synths ::SynthInfo
114116 }
115117 end
@@ -120,29 +122,29 @@ def fx
120122 end
121123 {
122124 items : items ,
123- template_path : synth_and_fx_template_path ,
124- interpolated_path : fx_interpolated_path ,
125- output_path : fx_toml_path ,
125+ template_path : :: SonicPi :: Paths . synth_and_fx_template_path ,
126+ interpolated_path : :: SonicPi :: Paths . fx_interpolated_path ,
127+ output_path : :: SonicPi :: Paths . fx_toml_path ,
126128 klass : SonicPi ::Synths ::FXInfo
127129 }
128130 end
129131
130132 def samples
131133 {
132134 items : SonicPi ::Synths ::SynthInfo . grouped_samples ,
133- template_path : samples_template_path ,
134- interpolated_path : samples_interpolated_path ,
135- output_path : samples_toml_path ,
135+ template_path : :: SonicPi :: Paths . samples_template_path ,
136+ interpolated_path : :: SonicPi :: Paths . samples_interpolated_path ,
137+ output_path : :: SonicPi :: Paths . samples_toml_path ,
136138 data_object : SonicPi ::Synths ::StereoPlayer . new
137139 }
138140 end
139141
140142 def lang
141143 {
142144 items : @@docs ,
143- template_path : lang_template_path ,
144- interpolated_path : lang_interpolated_path ,
145- output_path : lang_toml_path
145+ template_path : :: SonicPi :: Paths . lang_template_path ,
146+ interpolated_path : :: SonicPi :: Paths . lang_interpolated_path ,
147+ output_path : :: SonicPi :: Paths . lang_toml_path
146148 }
147149 end
148150end
0 commit comments