Skip to content

Commit

Permalink
bugfixes and review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
rpatters1 committed Oct 8, 2024
1 parent dcc2fd7 commit 2910f54
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/document_options_to_musescore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ function document_options_to_musescore()
file:close()
local files_to_process = {}
for folder, filename in utils.eachfile(selected_directory, true) do
print(folder, filename)
if (filename:sub(-MUSX_EXTENSION:len()) == MUSX_EXTENSION) or (filename:sub(-MUS_EXTENSION:len()) == MUS_EXTENSION) then
table.insert(files_to_process, {name = filename, folder = folder})
end
Expand Down
15 changes: 13 additions & 2 deletions src/library/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,23 @@ function utils.split_file_path(full_path)
local path_name = finale.FCString()
local file_name = finale.FCString()
local file_path = finale.FCString(full_path)
file_path:SplitToPathAndFile(path_name, file_name)
-- work around bug in SplitToPathAndFile when path is not specified
if file_path:FindFirst("/") >= 0 or (finenv.UI():IsOnWindows() and file_path:FindFirst("\\") >= 0) then
file_path:SplitToPathAndFile(path_name, file_name)
else
file_name.LuaString = full_path
end
-- do not use FCString.ExtractFileExtension() because it has a hard-coded limit of 7 characters (!)
local extension = file_name.LuaString:match("^.+(%..+)$")
extension = extension or ""
if #extension > 0 then
file_name:TruncateAt(file_name:FindLast(extension))
-- FCString.FindLast is unsafe if extension is not ASCII, so avoid using it
local truncate_pos = file_name.Length - finale.FCString(extension).Length
if truncate_pos > 0 then
file_name:TruncateAt(truncate_pos)
else
extension = ""
end
end
path_name:AssureEndingPathDelimiter()
return path_name.LuaString, file_name.LuaString, extension
Expand Down
2 changes: 1 addition & 1 deletion src/musicxml_massage_export.lua
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ function process_one_file(input_file)
return false
end

log_message("***** START OF PROCESSING *****")
log_message("\n\n***** START OF PROCESSING *****")
remove_processing_instructions(input_file, output_file)
local musicxml <close> = tinyxml2.XMLDocument()
local result = musicxml:LoadFile(output_file)
Expand Down

0 comments on commit 2910f54

Please sign in to comment.