MarkyC / Tab2PDF

CSE 2311 Software Project: https://wiki.eecs.yorku.ca/course_archive/2014-15/W/2311/proj
https://markyc.github.io/Tab2PDF/
1 stars 2 forks source link

Create *.pdf extension for every file we output #51

Closed deepxd closed 9 years ago

deepxd commented 9 years ago

When you select the place and name for output file, it shows that file is going to save as a .pdf file but actually every time when some output file is created, it has no extension. One needs to manually append the .pdf extension with the name in order to open the output pdf file.

In Main.java under the main function, output file name argument is set twise. For example:

Line:133 - arguments.setOutputFile(FileUtils.createTempFile(FILENAME, PDF_SUFFIX)); Line:134 - arguments.setOutputFile(findOutputFileInArgs(args));

So what's happening is, it first set the output file name with a default file name which is set in the "FILENAME" variable but on the very next line, code is overwriting this filename with the one which user specified from the command line or from user interface. This is the reason why that the software is not storing the output file with the .pdf extension and why it's not opening the generated pdf file at the end.

This functionality is written in the requirement documents but is not functional. The correct way to do this is, check if there is any filename specified by the user, if so, then set that name appended with the ".pdf" extension or otherwise in the else part, set the file name with the default name.

Example is:

if(findOutputFileInArgs(args) != "") //check if it is not empty {
arguments.setOutputFile(FileUtils.createTempFile(findOutputFileInArgs(args), PDF_SUFFIX)); } else { arguments.setOutputFile(FileUtils.createTempFile(FILENAME, PDF_SUFFIX)); }

Now your output file will be stored with the .pdf extension, either with user given name or with default name.