Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 119 for isAbs (0.08 sec)

  1. cmd/kubeadm/app/apis/kubeadm/validation/util_windows.go

    limitations under the License.
    */
    
    package validation
    
    import (
    	"path/filepath"
    )
    
    func isAbs(path string) bool {
    	// on Windows, filepath.IsAbs will not return True for paths prefixed with a slash, even
    	// though they can be used as absolute paths (https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats).
    	return filepath.IsAbs(path) || (len(path) > 0 && (path[0] == '\\' || path[0] == '/'))
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Aug 26 13:03:13 UTC 2022
    - 987 bytes
    - Viewed (0)
  2. pkg/util/filesystem/util_windows_test.go

    	wg.Wait()
    	unixln.Close()
    }
    
    func TestAbsWithSlash(t *testing.T) {
    	// On Windows, filepath.IsAbs will not return True for paths prefixed with a slash
    	assert.True(t, IsAbs("/test"))
    	assert.True(t, IsAbs("\\test"))
    
    	assert.False(t, IsAbs("./local"))
    	assert.False(t, IsAbs("local"))
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Apr 18 09:10:26 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  3. pkg/util/filesystem/util_unix.go

    		return false, fmt.Errorf("stat file %s failed: %v", filePath, err)
    	}
    	if fi.Mode()&os.ModeSocket == 0 {
    		return false, nil
    	}
    	return true, nil
    }
    
    // IsAbs is same as filepath.IsAbs on Unix.
    func IsAbs(path string) bool {
    	return filepath.IsAbs(path)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 10 17:13:59 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  4. src/path/filepath/example_unix_test.go

    	// .
    	// .
    	// /
    	// .
    }
    
    func ExampleIsAbs() {
    	fmt.Println("On Unix:")
    	fmt.Println(filepath.IsAbs("/home/gopher"))
    	fmt.Println(filepath.IsAbs(".bashrc"))
    	fmt.Println(filepath.IsAbs(".."))
    	fmt.Println(filepath.IsAbs("."))
    	fmt.Println(filepath.IsAbs("/"))
    	fmt.Println(filepath.IsAbs(""))
    
    	// Output:
    	// On Unix:
    	// true
    	// false
    	// false
    	// false
    	// true
    	// false
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 28 18:17:57 UTC 2021
    - 3.4K bytes
    - Viewed (0)
  5. src/internal/filepathlite/path_plan9.go

    }
    
    func localize(path string) (string, error) {
    	if path[0] == '#' || bytealg.IndexByteString(path, 0) >= 0 {
    		return "", errInvalidPath
    	}
    	return path, nil
    }
    
    // IsAbs reports whether the path is absolute.
    func IsAbs(path string) bool {
    	return stringslite.HasPrefix(path, "/") || stringslite.HasPrefix(path, "#")
    }
    
    // volumeNameLen returns length of the leading volume name on Windows.
    // It returns 0 elsewhere.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 23:07:50 UTC 2024
    - 952 bytes
    - Viewed (0)
  6. src/cmd/go/internal/web/url.go

    func urlToFilePath(u *url.URL) (string, error) {
    	if u.Scheme != "file" {
    		return "", errors.New("non-file URL")
    	}
    
    	checkAbs := func(path string) (string, error) {
    		if !filepath.IsAbs(path) {
    			return "", errNotAbsolute
    		}
    		return path, nil
    	}
    
    	if u.Path == "" {
    		if u.Host != "" || u.Opaque == "" {
    			return "", errors.New("file URL missing path")
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 13:43:51 UTC 2019
    - 2K bytes
    - Viewed (0)
  7. src/path/path_test.go

    }
    
    type IsAbsTest struct {
    	path  string
    	isAbs bool
    }
    
    var isAbsTests = []IsAbsTest{
    	{"", false},
    	{"/", true},
    	{"/usr/bin/gcc", true},
    	{"..", false},
    	{"/a/../bb", true},
    	{".", false},
    	{"./", false},
    	{"lala", false},
    }
    
    func TestIsAbs(t *testing.T) {
    	for _, test := range isAbsTests {
    		if r := IsAbs(test.path); r != test.isAbs {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 13 01:12:09 UTC 2020
    - 4.6K bytes
    - Viewed (0)
  8. cmd/kubeadm/app/apis/kubeadm/validation/util_unix.go

    See the License for the specific language governing permissions and
    limitations under the License.
    */
    
    package validation
    
    import (
    	"path/filepath"
    )
    
    func isAbs(path string) bool {
    	return filepath.IsAbs(path)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Aug 26 13:03:13 UTC 2022
    - 722 bytes
    - Viewed (0)
  9. src/internal/filepathlite/path_unix.go

    	return unixIsLocal(path)
    }
    
    func localize(path string) (string, error) {
    	if bytealg.IndexByteString(path, 0) >= 0 {
    		return "", errInvalidPath
    	}
    	return path, nil
    }
    
    // IsAbs reports whether the path is absolute.
    func IsAbs(path string) bool {
    	return stringslite.HasPrefix(path, "/")
    }
    
    // volumeNameLen returns length of the leading volume name on Windows.
    // It returns 0 elsewhere.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 23:07:50 UTC 2024
    - 935 bytes
    - Viewed (0)
  10. pkg/util/filesystem/util_windows.go

    			"filePath", filePath, "lastSocketErr", lastSocketErr, "err", err)
    		return false, nil
    	}
    	return true, nil
    }
    
    // IsAbs returns whether the given path is absolute or not.
    // On Windows, filepath.IsAbs will not return True for paths prefixed with a slash, even
    // though they can be used as absolute paths (https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats).
    //
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 10 17:13:59 UTC 2024
    - 4K bytes
    - Viewed (0)
Back to top