Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 899d6a5

Browse files
committed
fix: part 1 of NIO bugfixing
1 parent e5ca6b1 commit 899d6a5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/src/main/java/app/passwordstore/data/password/PasswordItem.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import app.passwordstore.ui.crypto.BasePGPActivity
1111
import app.passwordstore.ui.main.LaunchActivity
1212
import java.nio.file.Path
1313
import kotlin.io.path.absolutePathString
14+
import kotlin.io.path.name
1415
import kotlin.io.path.nameWithoutExtension
1516
import kotlin.io.path.pathString
1617
import kotlin.io.path.relativeTo
@@ -24,7 +25,7 @@ data class PasswordItem(
2425

2526
val name = file.nameWithoutExtension
2627

27-
val fullPathToParent = file.relativeTo(rootDir).parent.pathString
28+
val fullPathToParent = file.absolutePathString().replace(rootDir.absolutePathString(), "").replace(file.name, "")
2829

2930
val longName =
3031
BasePGPActivity.getLongName(fullPathToParent, rootDir.absolutePathString(), toString())

app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,10 @@ open class BasePGPActivity : AppCompatActivity() {
161161
*/
162162
fun getPGPIdentifiers(subDir: String): List<PGPIdentifier>? {
163163
val repoRoot = PasswordRepository.getRepositoryDirectory()
164+
// This should ideally be `repoRoot.resolve(subDir)` but for some reason doing that returns `/subDir` as the path
165+
// which doesn't work inside `findTillRoot`, so we're doing this manual dance.
164166
val gpgIdentifierFile =
165-
repoRoot.resolve(subDir).findTillRoot(".gpg-id", repoRoot)
167+
Paths.get(repoRoot.absolutePathString(), subDir).findTillRoot(".gpg-id", repoRoot)
166168
?: repoRoot.resolve(".gpg-id").createFile()
167169
val gpgIdentifiers =
168170
gpgIdentifierFile

0 commit comments

Comments
 (0)