Allow user to set remote directory
This commit is contained in:
parent
374b2d1c6d
commit
190050915e
2 changed files with 20 additions and 9 deletions
|
@ -91,8 +91,19 @@ class LoginWindow private constructor(parent: TApplication, flags: Int) :
|
|||
|
||||
//Called if on Linux and the login has been initiated
|
||||
fun loginActivityLinux() {
|
||||
var usernameDetail = loginField.text
|
||||
var serverDetail = serverField.text
|
||||
val usernameDetail = loginField.text
|
||||
val serverDetail = serverField.text
|
||||
val remoteDir = inputBox("Remote Directory", "What directory on the server would you like to mount?")
|
||||
val remoteDirDetail = remoteDir.text
|
||||
/* Have to figure out a way to unmount this.
|
||||
val localDir = if (remoteDir.isOk) {
|
||||
inputBox("Local Directory", "What directory on the local machine would you like to mount to?")
|
||||
}
|
||||
else {
|
||||
return
|
||||
}
|
||||
val localDirDetail = localDir.text
|
||||
*/
|
||||
// Create directory using bash
|
||||
ProcessBuilder("mkdir", "/tmp/kotRemote_mount")
|
||||
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
|
||||
|
@ -102,7 +113,7 @@ class LoginWindow private constructor(parent: TApplication, flags: Int) :
|
|||
// mount remote directory via sshfs
|
||||
ProcessBuilder(
|
||||
"sshfs",
|
||||
"$usernameDetail@$serverDetail:/home/$usernameDetail",
|
||||
"$usernameDetail@$serverDetail:$remoteDirDetail",
|
||||
"/tmp/kotRemote_mount"
|
||||
)
|
||||
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
|
||||
|
@ -113,18 +124,18 @@ class LoginWindow private constructor(parent: TApplication, flags: Int) :
|
|||
|
||||
//Called if on Windows and the login has been initiated
|
||||
fun loginActivityWindows() {
|
||||
var usernameDetail = loginField.text
|
||||
var serverDetail = serverField.text
|
||||
val usernameDetail = loginField.text
|
||||
val serverDetail = serverField.text
|
||||
// Due to the way sshfs-win works, we will additionally ask the user for a password
|
||||
var passwordBox = inputBox("Password", "Please enter your remote password")
|
||||
var passwordDetail = passwordBox.text
|
||||
val passwordBox = inputBox("Password", "Please enter your remote password")
|
||||
val passwordDetail = passwordBox.text
|
||||
// use the windows network mount command to mount via sshfs-win
|
||||
ProcessBuilder(
|
||||
"net",
|
||||
"use",
|
||||
"O:",
|
||||
"\\\\sshfs\\$usernameDetail@$serverDetail:/home/$usernameDetail",
|
||||
"$passwordDetail"
|
||||
passwordDetail
|
||||
)
|
||||
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
|
||||
.redirectError(ProcessBuilder.Redirect.INHERIT)
|
||||
|
|
|
@ -22,7 +22,7 @@ class WelcomeWindow private constructor(parent: TApplication, flags: Int) :
|
|||
)
|
||||
|
||||
// Close program, after detecting OS and unmounting the filesystem if necessary.
|
||||
addButton("Exit...", CENTERED + 28, CENTERED - 2,
|
||||
val exitButton = addButton("Exit...", CENTERED + 28, CENTERED - 2,
|
||||
object : TAction() {
|
||||
override fun DO() {
|
||||
if (xyz.limepot.kotRemote.osName == "LINUX") {
|
||||
|
|
Loading…
Reference in a new issue