예제 #1
0
func (m *Meld) InstallRust(args *InstallArgs, success *bool) error {
	m.mu.Lock()
	defer m.mu.Unlock()

	if args.SteamPath == "" {
		args.SteamPath = utils.GetSteamDir()
	}

	if args.RustPath == "" {
		args.RustPath = utils.GetRustDir()
	}

	// check for existing
	steamCmdPath, err := utils.GetSteamCmdPath(args.SteamPath)
	if err != nil {
		*success = false
		return fmt.Errorf("unable to find steam; perhaps try installing; err=%s", err)
	}

	if err := utils.InstallRust(steamCmdPath, args.RustPath, true); err != nil {
		*success = false
		return err
	}

	return nil
}
예제 #2
0
func (m *Meld) InstallSteam(args *InstallArgs, success *bool) error {
	m.mu.Lock()
	defer m.mu.Unlock()

	if args.SteamPath == "" {
		args.SteamPath = utils.GetSteamDir()
	}

	// check for existing
	_, err := utils.GetSteamCmdPath(args.SteamPath)
	if err != nil {
		if os.IsNotExist(err) {
			// install
			if err := utils.InstallSteamCmd(args.SteamPath); err != nil {
				*success = false
				return err
			}

			if _, err := utils.GetSteamCmdPath(args.SteamPath); err != nil {
				*success = false
				return err
			}
		} else {
			*success = false
			return err
		}
	}

	*success = true
	return nil
}