URI: 
       testenv_windows.go - hugo - [fork] hugo port for 9front
  HTML git clone https://git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
       testenv_windows.go (824B)
       ---
            1 // Copyright 2016 The Go Authors. All rights reserved.
            2 // Use of this source code is governed by a BSD-style
            3 // license that can be found in the LICENSE file.
            4 
            5 package testenv
            6 
            7 import (
            8         "errors"
            9         "os"
           10         "path/filepath"
           11         "sync"
           12         "syscall"
           13 )
           14 
           15 var hasSymlink = sync.OnceValues(func() (bool, string) {
           16         tmpdir, err := os.MkdirTemp("", "symtest")
           17         if err != nil {
           18                 panic("failed to create temp directory: " + err.Error())
           19         }
           20         defer os.RemoveAll(tmpdir)
           21 
           22         err = os.Symlink("target", filepath.Join(tmpdir, "symlink"))
           23         switch {
           24         case err == nil:
           25                 return true, ""
           26         case errors.Is(err, syscall.EWINDOWS):
           27                 return false, ": symlinks are not supported on your version of Windows"
           28         case errors.Is(err, syscall.ERROR_PRIVILEGE_NOT_HELD):
           29                 return false, ": you don't have enough privileges to create symlinks"
           30         }
           31         return false, ""
           32 })