// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !windows

package testenv

import (
	
	
	
	
)

func hasSymlink() ( bool,  string) {
	switch runtime.GOOS {
	case "plan9":
		return false, ""
	case "android", "wasip1":
		// For wasip1, some runtimes forbid absolute symlinks,
		// or symlinks that escape the current working directory.
		// Perform a simple test to see whether the runtime
		// supports symlinks or not. If we get a permission
		// error, the runtime does not support symlinks.
		,  := os.MkdirTemp("", "")
		if  != nil {
			return false, ""
		}
		defer func() {
			_ = os.RemoveAll()
		}()
		 := filepath.Join(, "testfile.txt")
		if  := os.WriteFile(, nil, 0644);  != nil {
			return false, ""
		}
		if  := os.Symlink(, filepath.Join(, "testlink"));  != nil {
			if SyscallIsNotSupported() {
				return false, fmt.Sprintf("symlinks unsupported: %s", .Error())
			}
			return false, ""
		}
	}

	return true, ""
}