Skip to content

Commit 81029b3

Browse files
committed
Build - fix more Path related issues
1 parent ffb634f commit 81029b3

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

app/server/ruby/bin/qt-doc.rb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@
8888
"zh_TW" => "臺灣華語" # Chinese (Traditional, Taiwan)
8989
]
9090

91-
FileUtils::rm_rf "#{Paths.qt_gui_path}/help/"
92-
FileUtils::mkdir "#{Paths.qt_gui_path}/help/"
91+
FileUtils::rm_rf "#{SonicPi::Paths.qt_gui_path}/help/"
92+
FileUtils::mkdir "#{SonicPi::Paths.qt_gui_path}/help/"
9393

94-
FileUtils::rm_rf "#{Paths.qt_gui_path}/info/"
95-
FileUtils::mkdir "#{Paths.qt_gui_path}/info/"
94+
FileUtils::rm_rf "#{SonicPi::Paths.qt_gui_path}/info/"
95+
FileUtils::mkdir "#{SonicPi::Paths.qt_gui_path}/info/"
9696

97-
FileUtils::rm_rf "#{Paths.qt_gui_path}/book/"
98-
FileUtils::mkdir "#{Paths.qt_gui_path}/book/"
97+
FileUtils::rm_rf "#{SonicPi::Paths.qt_gui_path}/book/"
98+
FileUtils::mkdir "#{SonicPi::Paths.qt_gui_path}/book/"
9999

100100
docs = []
101101
filenames = []
@@ -173,7 +173,7 @@
173173

174174
filenames << filename
175175

176-
File.open("#{Paths.qt_gui_path}/#{filename}", 'w') do |f|
176+
File.open("#{SonicPi::Paths.qt_gui_path}/#{filename}", 'w') do |f|
177177
f << "#{doc}"
178178
end
179179

@@ -198,7 +198,7 @@
198198
book_body = book[/<body.*?>/]
199199
book.gsub!(/<\/?body.*?>/, '')
200200
book.gsub!(/<meta http-equiv.*?>/, '')
201-
File.open("#{Paths.qt_gui_path}/book/Sonic Pi - #{name.capitalize}" + (lang != "en" ? " (#{lang})" : "") + ".html", 'w') do |f|
201+
File.open("#{SonicPi::Paths.qt_gui_path}/book/Sonic Pi - #{name.capitalize}" + (lang != "en" ? " (#{lang})" : "") + ".html", 'w') do |f|
202202
f << "<link rel=\"stylesheet\" href=\"../theme/light/doc-styles.css\" type=\"text/css\"/>\n"
203203
f << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n\n"
204204
f << book_body << "\n"
@@ -219,9 +219,9 @@
219219
docs << "\n // language #{lang}\n"
220220
tutorial_html_map = {}
221221
if lang == "en" then
222-
markdown_path = Paths.tutorial_path
222+
markdown_path = SonicPi::Paths.tutorial_path
223223
else
224-
markdown_path = File.expand_path("../generated/#{lang}/tutorial", Paths.tutorial_path)
224+
markdown_path = File.expand_path("../generated/#{lang}/tutorial", SonicPi::Paths.tutorial_path)
225225
end
226226
Dir["#{markdown_path}/*.md"].sort.each do |path|
227227
f = File.open(path, 'r:UTF-8')
@@ -242,7 +242,7 @@
242242
example_html_map = {}
243243
example_dirs = ["Apprentice", "Illusionist", "Magician", "Sorcerer", "Wizard", "Algomancer"]
244244
example_dirs.each do |ex_dir|
245-
Dir["#{Paths.examples_path}/#{ex_dir.downcase}/*.rb"].sort.each do |path|
245+
Dir["#{SonicPi::Paths.examples_path}/#{ex_dir.downcase}/*.rb"].sort.each do |path|
246246
bname = File.basename(path, ".rb")
247247
bname = ActiveSupport::Inflector.titleize(bname)
248248
name = "[#{ex_dir}] #{bname}"
@@ -270,7 +270,7 @@
270270
# before the generic language code,
271271
# e.g., "de_CH" should be handled before "de"
272272
languages =
273-
Dir[File.expand_path("../lang/sonic-pi-tutorial-*.po", Paths.tutorial_path)].
273+
Dir[File.expand_path("../lang/sonic-pi-tutorial-*.po", SonicPi::Paths.tutorial_path)].
274274
map { |p| File.basename(p).gsub(/sonic-pi-tutorial-(.*?).po/, '\1') }.
275275
sort_by {|n| [-n.length, n]}
276276

@@ -339,7 +339,7 @@ def generate_ui_lang_names
339339
locale_arrays << "\n};\n"
340340

341341
# Write the map to lang_list.h
342-
content = File.readlines("#{Paths.qt_gui_path}/utils/lang_list.tmpl")
342+
content = File.readlines("#{SonicPi::Paths.qt_gui_path}/utils/lang_list.tmpl")
343343
lang_names_generated = content.take_while { |line| !line.start_with?("// AUTO-GENERATED")}
344344
lang_names_generated << "// AUTO-GENERATED HEADER FILE\n"
345345
lang_names_generated << "// Do not add any code to this file\n"
@@ -351,7 +351,7 @@ def generate_ui_lang_names
351351
lang_names_generated << locale_arrays.join()
352352
lang_names_generated << "#endif\n"
353353

354-
File.open("#{Paths.qt_gui_path}/utils/lang_list.h", 'w') do |f|
354+
File.open("#{SonicPi::Paths.qt_gui_path}/utils/lang_list.h", 'w') do |f|
355355
f << lang_names_generated.join()
356356
end
357357
end
@@ -361,7 +361,7 @@ def generate_ui_lang_names
361361
if options[:output_name] then
362362
cpp = options[:output_name]
363363
else
364-
cpp = "#{Paths.qt_gui_path}/ruby_help.h"
364+
cpp = "#{SonicPi::Paths.qt_gui_path}/ruby_help.h"
365365
end
366366

367367
content = File.readlines(cpp)
@@ -378,7 +378,7 @@ def generate_ui_lang_names
378378
f << new_content.join
379379
end
380380

381-
File.open("#{Paths.qt_gui_path}/help_files.qrc", 'w') do |f|
381+
File.open("#{SonicPi::Paths.qt_gui_path}/help_files.qrc", 'w') do |f|
382382
f << "<RCC>\n <qresource prefix=\"/\">\n"
383383
f << filenames.map{|n| " <file>#{n}</file>\n"}.join
384384
f << " </qresource>\n</RCC>\n"
@@ -390,11 +390,11 @@ def generate_ui_lang_names
390390
###
391391

392392
info_sources = ["CHANGELOG.md", "CONTRIBUTORS.md", "COMMUNITY.md", "CORETEAM.html", "LICENSE.md"]
393-
outputdir = "#{Paths.qt_gui_path}/info"
393+
outputdir = File.absolute_path("#{SonicPi::Paths.qt_gui_path}/info")
394394

395395
info_sources.each do |src|
396396

397-
input_path = "#{root_path}/#{src}"
397+
input_path = File.absolute_path("#{SonicPi::Paths.root_path}/#{src}")
398398
base = File.basename(input_path)
399399
m = base.match /(.*)\.(.*)/
400400
bn = m[1]

0 commit comments

Comments
 (0)