Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix userHomeVfs for native targets + test #1127

Merged
merged 3 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package com.soywiz.korio.file.std

import com.soywiz.korio.file.PathInfo
import com.soywiz.korio.file.parent
import com.soywiz.korio.lang.Environment
import com.soywiz.korio.lang.tempPath
import com.soywiz.korio.lang.*

/**
* Contain standard paths to different parts of the operating system.
Expand Down Expand Up @@ -42,7 +41,7 @@ interface StandardPathsBase {
* - windows: /Users/user
* - macos: /Users/user
*/
val userHome: String get() = Environment["~"] ?: "/tmp"
soywiz marked this conversation as resolved.
Show resolved Hide resolved
val userHome: String get() = Environment.expand("~")

/**
* Temp folder where to store temporal files that might be discarded anytime.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.soywiz.korio.file.std

import com.soywiz.korio.file.*
import com.soywiz.korio.lang.*
import kotlin.test.*

class LocalVfsNativeTest {

@Test
fun testUserHomeVfsValue() {
val homePath = Environment["HOME"]
val expectedResult = if (homePath != null) homePath else "/tmp"
assertEquals(
expectedResult.trimEnd('/'),
userHomeVfs.absolutePath.trimEnd('/')
)
}

}