Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 608 for getwd (0.04 sec)

  1. src/os/file_open_wasip1.go

    	// os.(*File).Chdir is emulated by setting the working directory to the
    	// absolute path that this file was opened at, which is why we have to
    	// resolve and capture it here.
    	if filePath[0] != '/' {
    		wd, err := syscall.Getwd()
    		if err != nil {
    			return -1, poll.SysFile{}, err
    		}
    		absPath = joinPath(wd, filePath)
    	}
    	fd, err := syscall.Open(absPath, flag, perm)
    	return fd, poll.SysFile{Path: absPath}, err
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 07 23:34:21 UTC 2023
    - 818 bytes
    - Viewed (0)
  2. src/os/path_windows.go

    	if !filepathlite.IsAbs(path) {
    		// If the path is relative, we need to prepend the working directory
    		// plus a separator to the path before we can determine if it's too long.
    		// We don't want to call syscall.Getwd here, as that call is expensive to do
    		// every time fixLongPath is called with a relative path, so we use a cache.
    		// Note that getwdCache might be outdated if the working directory has been
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 18:44:48 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  3. src/cmd/go/internal/base/path.go

    // UncachedCwd is appropriate to call early in program startup before flag parsing,
    // because the -C flag may change the current directory.
    func UncachedCwd() string {
    	wd, err := os.Getwd()
    	if err != nil {
    		Fatalf("cannot determine current directory: %v", err)
    	}
    	return wd
    }
    
    // Cwd returns the current working directory at the time of the first call.
    func Cwd() string {
    	cwdOnce.Do(func() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat May 20 19:17:27 UTC 2023
    - 2K bytes
    - Viewed (0)
  4. cmd/gotemplate/gotemplate_test.go

    		},
    		"include": {
    			in:       `{{include "test.txt" | indent 2}}`,
    			files:    map[string]string{"test.txt": "hello\nworld"},
    			expected: "hello\n  world",
    		},
    	} {
    		cwd, err := os.Getwd()
    		require.NoError(t, err)
    
    		t.Run(name, func(t *testing.T) {
    			tmp := t.TempDir()
    			for fileName, fileContent := range tt.files {
    				err := os.WriteFile(path.Join(tmp, fileName), []byte(fileContent), 0666)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jan 22 13:43:42 UTC 2024
    - 2.7K bytes
    - Viewed (0)
  5. src/runtime/testdata/testprog/syscalls_linux.go

    }
    
    func getcwd() (string, error) {
    	if !syscall.ImplementsGetwd {
    		return "", nil
    	}
    	// Use the syscall to get the current working directory.
    	// This is imperative for checking for OS thread state
    	// after an unshare since os.Getwd might just check the
    	// environment, or use some other mechanism.
    	var buf [4096]byte
    	n, err := syscall.Getcwd(buf[:])
    	if err != nil {
    		return "", err
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 20:00:09 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  6. src/os/executable_path.go

    //go:build aix || openbsd
    
    package os
    
    // We query the working directory at init, to use it later to search for the
    // executable file
    // errWd will be checked later, if we need to use initWd
    var initWd, errWd = Getwd()
    
    func executable() (string, error) {
    	var exePath string
    	if len(Args) == 0 || Args[0] == "" {
    		return "", ErrNotExist
    	}
    	if IsPathSeparator(Args[0][0]) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 28 18:17:57 UTC 2021
    - 2.3K bytes
    - Viewed (0)
  7. src/cmd/go/internal/script/state.go

    			return err
    		}
    		if err := os.WriteFile(name, f.Data, 0666); err != nil {
    			return err
    		}
    	}
    
    	return nil
    }
    
    // Getwd returns the directory in which to run the next script command.
    func (s *State) Getwd() string { return s.pwd }
    
    // Logf writes output to the script's log without updating its stdout or stderr
    // buffers. (The output log functions as a kind of meta-stderr.)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 31 20:33:02 UTC 2023
    - 6.9K bytes
    - Viewed (0)
  8. src/os/executable_test.go

    	}
    	return os.SameFile(fi1, fi2)
    }
    
    func init() {
    	if e := os.Getenv(executable_EnvVar); e != "" {
    		// first chdir to another path
    		dir := "/"
    		if runtime.GOOS == "windows" {
    			cwd, err := os.Getwd()
    			if err != nil {
    				panic(err)
    			}
    			dir = filepath.VolumeName(cwd)
    		}
    		os.Chdir(dir)
    		if ep, err := os.Executable(); err != nil {
    			fmt.Fprint(os.Stderr, "ERROR: ", err)
    		} else {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 05 23:35:32 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  9. src/cmd/go/scriptcmds_test.go

    	return script.Command(
    		script.CmdUsage{
    			Summary: "run the platform C compiler",
    			Args:    "args...",
    		},
    		func(s *script.State, args ...string) (script.WaitFunc, error) {
    			b := work.NewBuilder(s.Getwd())
    			wait, err := cmdExec.Run(s, append(b.GccCmd(".", ""), args...)...)
    			if err != nil {
    				return wait, err
    			}
    			waitAndClean := func(s *script.State) (stdout, stderr string, err error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 07 18:33:17 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  10. src/io/fs/walk_test.go

    	if err != nil {
    		*errors = append(*errors, err)
    		if clear {
    			return nil
    		}
    		return err
    	}
    	return nil
    }
    
    func TestWalkDir(t *testing.T) {
    	tmpDir := t.TempDir()
    
    	origDir, err := os.Getwd()
    	if err != nil {
    		t.Fatal("finding working dir:", err)
    	}
    	if err = os.Chdir(tmpDir); err != nil {
    		t.Fatal("entering temp dir:", err)
    	}
    	defer os.Chdir(origDir)
    
    	fsys := makeTree()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 18 15:21:18 UTC 2022
    - 3K bytes
    - Viewed (0)
Back to top