github.com/richardwilkes/toolbox@v1.121.0/desktop/browser_windows.go (about)

     1  // Copyright (c) 2016-2024 by Richard A. Wilkes. All rights reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the Mozilla Public
     4  // License, version 2.0. If a copy of the MPL was not distributed with
     5  // this file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6  //
     7  // This Source Code Form is "Incompatible With Secondary Licenses", as
     8  // defined by the Mozilla Public License, version 2.0.
     9  
    10  // Package desktop provides desktop integration utilities.
    11  package desktop
    12  
    13  import "strings"
    14  
    15  func cmdAndArgs(pathOrURL string) (cmdName string, args []string) {
    16  	if strings.HasPrefix(pathOrURL, "http://") || strings.HasPrefix(pathOrURL, "https://") {
    17  		return "cmd", []string{"/c", "start", pathOrURL}
    18  	}
    19  	return "explorer", []string{pathOrURL}
    20  }