Skip to content

Commit

Permalink
Fix invalid dest path
Browse files Browse the repository at this point in the history
Now the files are saved into Downloads, as some devices dont have the Documents folder by default.
  • Loading branch information
XomaDev committed Aug 5, 2023
1 parent 6d6c79e commit 7a424ef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class FilesFragment(
}
view.findViewById<TextView>(R.id.filesTip).text =
Html.fromHtml(
"Files are saved into the <b>Documents</b> folder.",
"Files are saved into the <b>Downloads</b> folder.",
Html.FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH
)
view.findViewById<Button>(R.id.clearHistory).setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,13 @@ class FileReceiveService : Service() {

private fun initSocketConnection(port: Int, host: String) {
val externalStorageDir = getExternalStoragePublicDirectory(
Environment.DIRECTORY_DOCUMENTS
Environment.DIRECTORY_DOWNLOADS
)

val saveFileName = getWithRandomizedName(fileName)
val file = File(
externalStorageDir, saveFileName
)
file.createNewFile()
Log.d(TAG, "Path = $file")

val result = receiveFile(
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="Files are saved into the Documents folder" />
android:text="Files are saved into the Downloads folder" />
</com.google.android.material.card.MaterialCardView>


Expand Down

0 comments on commit 7a424ef

Please sign in to comment.