Skip to content

Commit a010a5d

Browse files
committed
Set default song and patterns folder somewhere inside ~/Music
1 parent 15be228 commit a010a5d

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

extensions/gmmacostools/gmmacostools.yy

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
368 Bytes
Binary file not shown.

objects/obj_controller/Create_0.gml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ if (os_type = os_windows) {
77
if (!directory_exists(data_directory)) execute_program("Xcopy", @'/E /I "' + filename_dir(bundled_data_directory) + @'" "' + filename_dir(data_directory) + @'"', true)
88
if (!directory_exists(songs_directory)) execute_program("Xcopy", @'/E /I "' + filename_dir(bundled_songs_directory) + @'" "' + filename_dir(songs_directory) + @'"', true)
99
if (!directory_exists(pattern_directory)) execute_program("Xcopy", @'/E /I "' + filename_dir(bundled_pattern_directory) + @'" "' + filename_dir(pattern_directory) + @'"', true)
10-
} if (os_type = os_macosx || os_type = os_linux) {
10+
} if (os_type = os_macosx) {
1111
if (!directory_exists(data_directory)) execute_program("cp", @'-fR "' + filename_dir(bundled_data_directory) + @'" "' + filename_dir(data_directory) + @'"', true)
12-
if (!directory_exists(songs_directory)) execute_program("cp", @'-fR "' + filename_dir(bundled_songs_directory) + @'" "' + filename_dir(songs_directory) + @'"', true)
13-
if (!directory_exists(pattern_directory)) execute_program("cp", @'-fR "' + filename_dir(bundled_pattern_directory) + @'" "' + filename_dir(pattern_directory) + @'"', true)
12+
if (!directory_exists(songs_directory)) directory_create(songs_directory)
13+
if (!directory_exists(pattern_directory)) directory_create(pattern_directory)
14+
} if (os_type = os_linux) {
15+
if (!directory_exists(data_directory)) execute_program("cp", @'-fR "' + filename_dir(bundled_data_directory) + @'" "' + filename_dir(data_directory) + @'"', true)
16+
if (!directory_exists(songs_directory)) execute_program("cp", @'-fR "' + filename_dir(bundled_songs_directory) + @'" "' + filename_dir(songs_directory) + @'"', true)
17+
if (!directory_exists(pattern_directory)) execute_program("cp", @'-fR "' + filename_dir(bundled_pattern_directory) + @'" "' + filename_dir(pattern_directory) + @'"', true)
1418
} if (os_type = os_ios) {
1519
if (!directory_exists(data_directory)) directory_copy(bundled_data_directory, data_directory);
1620
if (!directory_exists(songs_directory)) directory_copy(bundled_songs_directory, songs_directory);

scripts/draw_window_preferences/draw_window_preferences.gml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ function draw_window_preferences() {
231231
if (theme = 3) draw_theme_font(font_main)
232232
if (language != 1) {
233233
if (draw_checkbox(x1 + 40, y1 + 200 + (theme = 3) * 22, show_oldwarning, "Show warning when opening older songs", "Whether to show a warning when opening a song\nsaved in an older version of Note Block Studio.", false, true)) show_oldwarning = !show_oldwarning
234-
draw_text_dynamic(x1 + 40, y1 + 230 + (theme = 3) * 22, "Song folder: " + string_truncate(songfolder, 340), true)
234+
draw_text_dynamic(x1 + 40, y1 + 230 + (theme = 3) * 22, "Song folder: " + string_truncate(string_replace(songfolder, "/Library/Containers/org.opennbs.onbs/Data", ""), 340), true)
235235
popup_set_window(x1 + 40, y1 + 230 + (theme = 3) * 22, 430, 18, songfolder)
236236
if (draw_button2(x1 + 40, y1 + 246 + (theme = 3) * 22, 76, "Open", 0, 1)) {
237237
if (!directory_exists_lib(songfolder)) {
@@ -247,7 +247,7 @@ function draw_window_preferences() {
247247
}
248248
if (draw_button2(x1 + 40 + 84 + 84, y1 + 246 + (theme = 3) * 22, 96, "Use default", 0, 1)) songfolder = songs_directory
249249

250-
draw_text_dynamic(x1 + 40, y1 + 280 + (theme = 3) * 22, "Pattern folder: " + string_truncate(patternfolder, 340), true)
250+
draw_text_dynamic(x1 + 40, y1 + 280 + (theme = 3) * 22, "Pattern folder: " + string_truncate(string_replace(patternfolder, "/Library/Containers/org.opennbs.onbs/Data", ""), 340), true)
251251
popup_set_window(x1 + 40, y1 + 280 + (theme = 3) * 22, 430, 18, patternfolder)
252252
if (draw_button2(x1 + 40, y1 + 296 + (theme = 3) * 22, 76, "Open", 0, 1)) {
253253
if (!directory_exists_lib(patternfolder)) {
@@ -264,7 +264,7 @@ function draw_window_preferences() {
264264
if (draw_button2(x1 + 40 + 84 + 84, y1 + 296 + (theme = 3) * 22, 96, "Use default", 0, 1)) patternfolder = pattern_directory
265265
} else {
266266
if (draw_checkbox(x1 + 40, y1 + 200 + (theme = 3) * 22, show_oldwarning, "打开旧版格式时提示", "打开在旧版 Note Block Studio 中保存的文件时是否显示警告。", false, true)) show_oldwarning = !show_oldwarning
267-
draw_text_dynamic(x1 + 40, y1 + 230 + (theme = 3) * 22, "歌曲路径: " + string_truncate(songfolder, 340))
267+
draw_text_dynamic(x1 + 40, y1 + 230 + (theme = 3) * 22, "歌曲路径: " + string_truncate(string_replace(songfolder, "/Library/Containers/org.opennbs.onbs/Data", ""), 340))
268268
popup_set_window(x1 + 40, y1 + 230 + (theme = 3) * 22, 430, 18, songfolder)
269269
if (draw_button2(x1 + 40, y1 + 246 + (theme = 3) * 22, 76, "打开", 0, 1)) {
270270
if (!directory_exists_lib(songfolder)) {
@@ -280,7 +280,7 @@ function draw_window_preferences() {
280280
}
281281
if (draw_button2(x1 + 40 + 84 + 84, y1 + 246 + (theme = 3) * 22, 96, "还原默认", 0, 1)) songfolder = songs_directory
282282

283-
draw_text_dynamic(x1 + 40, y1 + 280 + (theme = 3) * 22, "片段路径: " + string_truncate(patternfolder, 340))
283+
draw_text_dynamic(x1 + 40, y1 + 280 + (theme = 3) * 22, "片段路径: " + string_truncate(string_replace(patternfolder, "/Library/Containers/org.opennbs.onbs/Data", ""), 340))
284284
popup_set_window(x1 + 40, y1 + 280 + (theme = 3) * 22, 430, 18, patternfolder)
285285
if (draw_button2(x1 + 40, y1 + 296 + (theme = 3) * 22, 76, "打开", 0, 1)) {
286286
if (!directory_exists_lib(patternfolder)) {

scripts/macros/macros.gml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function macros() {
2222

2323
#macro current_directory working_directory
2424
#macro file_directory game_save_id
25+
#macro music_directory (os_type = os_macosx ? macos_music_dir() : "") + condstr(os_type = os_windows, "\\", "/")
2526

2627
#macro bundled_data_directory current_directory + "data" + condstr(os_type = os_windows, "\\", "/")
2728
#macro bundled_sounds_directory current_directory + "data" + condstr(os_type = os_windows, "\\", "/") + "sounds" + condstr(os_type = os_windows, "\\", "/")
@@ -31,8 +32,8 @@ function macros() {
3132
#macro data_directory condstr(os_type = os_windows, working_directory, file_directory) + "data" + condstr(os_type = os_windows, "\\", "/")
3233
#macro sounds_directory condstr(os_type = os_windows, working_directory, file_directory) + "data" + condstr(os_type = os_windows, "\\", "/") + "sounds" + condstr(os_type = os_windows, "\\", "/")
3334
#macro resource_directory sounds_directory + "resourcepacks" + condstr(os_type = os_windows, "\\", "/")
34-
#macro songs_directory condstr(os_type = os_windows, working_directory, file_directory) + "songs" + condstr(os_type = os_windows, "\\", "/")
35-
#macro pattern_directory condstr(os_type = os_windows, working_directory, file_directory) + "patterns" + condstr(os_type = os_windows, "\\", "/")
35+
#macro songs_directory (os_type = os_macosx ? music_directory + "Note Block Studio/" : (os_type = os_windows ? working_directory : file_directory) + "songs" + (os_type = os_windows ? "\\" : "/"))
36+
#macro pattern_directory (os_type = os_macosx ? music_directory + "Note Block Studio/patterns/" : (os_type = os_windows ? working_directory : file_directory) + "patterns" + (os_type = os_windows ? "\\" : "/"))
3637
#macro log_file file_directory + "log.txt"
3738
#macro temp_file file_directory + "tmp.file"
3839
#macro update_file file_directory + "note block studio installer.exe"

0 commit comments

Comments
 (0)