Skip to content

Commit

Permalink
path of config.txt should be in jar(or exe) path
Browse files Browse the repository at this point in the history
  • Loading branch information
awidesky committed May 25, 2021
1 parent 2ab0345 commit 058bb55
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ YoutubeAudioAutoDownloader-resources/*
logs/
build/
jre*/

config.txt

# Test audio files
*.mp3
Expand Down
7 changes: 5 additions & 2 deletions ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
</manifest>
<fileset dir="${dir.buildfile}/bin"/>
</jar>

<copy file="${dir.buildfile}/config.txt" tofile="${dir.buildfile}/build/config.txt"/>
<copy file="${dir.buildfile}/YoutubeAudioAutoDownloader-resources/icon.jpg" tofile="${dir.buildfile}/build/icon.jpg"/>

</target>

<target depends="create_run_jar" name="deploy">

<copy file="${dir.buildfile}/YoutubeAudioAutoDownloader-resources/icon.jpg" tofile="${dir.buildfile}/build/icon.jpg"/>

<copy todir="${dir.buildfile}/build/win_standalone">
<fileset dir="${dir.buildfile}">
<include name="jre/**"/>
Expand All @@ -51,6 +53,7 @@
</fileset>
</copy>

<copy file="${dir.buildfile}/config.txt" tofile="${dir.buildfile}/build/win_standalone/config.txt"/>

<launch4j configFile="${dir.buildfile}/Launch4J.xml" jar="${dir.buildfile}\build\YoutubeAudioAutoDownloader ${version}.jar" outfile="${dir.buildfile}\build\win_standalone\YoutubeAudioAutoDownloader ${version}.exe"/>

Expand Down
6 changes: 3 additions & 3 deletions src/com/awidesky/YoutubeClipboardAutoDownloader/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private static void readProperties() {
String c = "Download link automatically";

try (BufferedReader br = new BufferedReader(new FileReader(new File(
YoutubeAudioDownloader.getProjectpath() + File.separator + "YoutubeAudioAutoDownloader-resources" + File.separator + "config.txt")))) {
YoutubeAudioDownloader.getProjectpath() + File.separator + "config.txt")))) {

String p1 = Optional.of(br.readLine()).orElse("SavePath=" + p) .split("=")[1];
String f1 = Optional.of(br.readLine()).orElse("Format=" + f) .split("=")[1];
Expand Down Expand Up @@ -317,10 +317,10 @@ public static void writeProperties() {

/** Write <code>properties</code> */
try (BufferedWriter bw = new BufferedWriter(new FileWriter(new File(
YoutubeAudioDownloader.getProjectpath() + File.separator + "YoutubeAudioAutoDownloader-resources" + File.separator + "config.txt")))) {
YoutubeAudioDownloader.getProjectpath() + File.separator + "config.txt")))) {

File cfg = new File(
YoutubeAudioDownloader.getProjectpath() + File.separator + "YoutubeAudioAutoDownloader-resources" + File.separator + "config.txt");
YoutubeAudioDownloader.getProjectpath() + File.separator + "config.txt");

if (!cfg.exists()) cfg.createNewFile();

Expand Down

0 comments on commit 058bb55

Please sign in to comment.