Skip to content

Commit

Permalink
Add touch method to Builder class and update handling of empty files
Browse files Browse the repository at this point in the history
- Add a touch method to the Builder class for writing empty files to the installation package.
- Rename the existing empty file to a more explicit name and move it to the Builder class's definition folder.
- This change abstracts the touch-equivalent operation, replacing the previous method of writing empty files using the copy_file method.
  • Loading branch information
shinokaro committed Jun 3, 2024
1 parent 1e9a284 commit 5f5f1b1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/ocran
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ EOF
# Workaround: RubyInstaller cannot find the msys folder if ../msys64/usr/bin/msys-2.0.dll is not present (since RubyInstaller-2.4.1 rubyinstaller 2 issue 23)
# Add an empty file to /msys64/usr/bin/msys-2.0.dll if the dll was not required otherwise
unless builder.files.values.any? { |entry, _src| entry.to_s.include?("msys-2.0.dll") }
builder.copy(Pathname(File.dirname(__FILE__)) / "../share/ocran/empty-msys-2.0.dll", 'msys64/usr/bin/msys-2.0.dll')
builder.touch('msys64/usr/bin/msys-2.0.dll')
end

# Set environment variable
Expand Down
5 changes: 5 additions & 0 deletions lib/ocran/inno_setup_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ def copy_file(src, tgt, dest_name: nil)
alias copy copy_file
alias cp copy_file

def touch(tgt)
src = Pathname.new(File.expand_path("touch_placeholder", __dir__))
copy_file(src, tgt)
end

# Specifies the final application script to be launched, which can be called
# from any position in the data stream. It cannot be specified more than once.
def set_script(image, script, *argv)
Expand Down
5 changes: 5 additions & 0 deletions lib/ocran/stub_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ def copy_file(src, tgt)
alias copy copy_file
alias cp copy_file

def touch(tgt)
src = Pathname.new(File.expand_path("touch_placeholder", __dir__))
copy_file(src, tgt)
end

# Specifies the final application script to be launched, which can be called
# from any position in the data stream. It cannot be specified more than once.
#
Expand Down
File renamed without changes.

0 comments on commit 5f5f1b1

Please sign in to comment.