Skip to content

Commit

Permalink
refactor: update temp file names
Browse files Browse the repository at this point in the history
  • Loading branch information
ublefo committed Apr 20, 2024
1 parent d83678c commit 96748fe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/helpers/file_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def line_wrap(path, width: 160)
dir = File.dirname(path)
basename = File.basename(path)
temp_file = Tempfile.new('truncated_file')
output = File.join(dir, "WRAPPED-#{basename}")
output = File.join(dir, "#{basename}.tmp")
begin
logger.debug "Applying hard column width limit of #{hard_limit} to #{path}"
system("cut -c-#{hard_limit} #{path.shellescape} > #{temp_file.path}", exception: true)
Expand Down
2 changes: 1 addition & 1 deletion app/models/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ def make_pdf
next unless f[:type] == "code"
name = File.basename(f[:path])
dir = File.dirname(f[:path])
tempfile_path = File.join(dir, "WRAPPED-" + name)
tempfile_path = File.join(dir, "#{name}.tmp")
if File.exist? tempfile_path
File.unlink(tempfile_path)
logger.debug "Deleted #{tempfile_path}"
Expand Down
2 changes: 1 addition & 1 deletion app/views/task/task_pdf.pdf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ No Tutor % Supervisor's Name
dir = File.dirname(file[:path])
name = File.basename(file[:path])
pygments_lang = Task.pygments_lang(File.extname(file[:path])[1..-1])
wrapped_file = File.join(dir, "WRAPPED-" + name)
wrapped_file = File.join(dir, "#{name}.tmp")
%>
<% unless File.symlink?(wrapped_file) %>
\begin{tcolorbox}[colback=blue!5!white,colframe=blue!75!black]
Expand Down

0 comments on commit 96748fe

Please sign in to comment.