Set permissions when creating files and folders

This commit is contained in:
Matéo Duparc 2021-06-26 12:17:10 +02:00
parent f58517e904
commit 286253c542
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E
2 changed files with 4 additions and 3 deletions

View File

@ -2,12 +2,13 @@ package sushi.hardcore.droidfs
import android.net.Uri import android.net.Uri
import java.io.File import java.io.File
import java.util.*
class ConstValues { class ConstValues {
companion object { companion object {
const val creator = "DroidFS" const val creator = "DroidFS"
const val gocryptfsConfFilename = "gocryptfs.conf" const val gocryptfsConfFilename = "gocryptfs.conf"
const val FILE_MODE = 384 //0600
const val DIRECTORY_MODE = 448 //0700
const val volumeDatabaseName = "SavedVolumes" const val volumeDatabaseName = "SavedVolumes"
const val sort_order_key = "sort_order" const val sort_order_key = "sort_order"
val fakeUri: Uri = Uri.parse("fakeuri://droidfs") val fakeUri: Uri = Uri.parse("fakeuri://droidfs")

View File

@ -66,7 +66,7 @@ class GocryptfsVolume(var sessionID: Int) {
fun mkdir(dir_path: String): Boolean { fun mkdir(dir_path: String): Boolean {
synchronized(this){ synchronized(this){
return native_mkdir(sessionID, dir_path, 0) return native_mkdir(sessionID, dir_path, ConstValues.DIRECTORY_MODE)
} }
} }
@ -108,7 +108,7 @@ class GocryptfsVolume(var sessionID: Int) {
fun openWriteMode(file_path: String): Int { fun openWriteMode(file_path: String): Int {
synchronized(this){ synchronized(this){
return native_open_write_mode(sessionID, file_path, 0) return native_open_write_mode(sessionID, file_path, ConstValues.FILE_MODE)
} }
} }