portable

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package portable keeps the data of a portable copy of SSHYard beside its executable, in sshyard_data, in place of the user's application data, and moves it between the two.

The folder is the switch: a copy whose executable has sshyard_data beside it keeps its data there. A move is asked for while the app runs (Request) and made by the next launch (Apply), before anything opens a file of the data.

Index

Constants

View Source
const Dir = "sshyard_data"

Dir is the folder beside the executable that holds a portable copy's data.

Variables

View Source
var (
	// ErrOccupied is a destination that already holds data.
	ErrOccupied = errors.New("portable: destination already holds data")
	// ErrBusy is data that another running copy uses.
	ErrBusy = errors.New("portable: data in use")
)

Functions

func Active

func Active(goos, exeDir string) bool

Active reports whether the copy in exeDir keeps its data beside it.

func Apply

func Apply(exeDir, appData string, wait time.Duration) error

Apply makes the move Request asked for, between appData, the user's application data folder of the app, and the folder beside the executable in exeDir; it waits up to wait for the copy that asked to quit. A move is whole or not at all: on an error the data stays where it was. The request is answered either way.

func Move

func Move(src, dst string, wait time.Duration) error

Move moves the data folder src to dst, which must hold no data, waiting up to wait for a copy that uses src to quit. It copies src beside dst and renames the copy into place, then takes src away; on an error dst is gone again and src is as it was. A missing src moves as an empty folder.

func Path

func Path(exeDir string) string

Path is the portable data folder of the executable in exeDir.

func Request

func Request(exeDir string, portable bool) error

Request asks the next launch to move the data of the copy in exeDir beside it (portable) or back to the application data.

func Supported

func Supported(goos, exeDir string) bool

Supported reports whether the data of the copy in exeDir may move beside it: a copy on Windows or Linux that no installer manages, in a folder it can write.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL