---
title: filesystem | CodeWeaver Docs
description: API reference for codeweaver.core.utils.filesystem
url: "https://docs.knitli.com/api/core/utils/filesystem"
type: static
generatedAt: "2026-04-17T17:21:08.290Z"
---

# filesystem
       [Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[View in Markdown](/codeweaver/api/core/utils/filesystem.md)       [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F)[Share on X](https://x.com/intent/tweet?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F&text=filesystem)[Share on Threads](https://threads.net/intent/post?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F&text=filesystem)[Share on Bluesky](https://bsky.app/intent/compose?text=filesystem%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F)[Share on Reddit](https://reddit.com/submit?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F&title=filesystem)[Share on Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F&t=filesystem)[Share on Email](mailto:?subject=filesystem&body=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F)[Share on WhatsApp](https://wa.me/?text=filesystem%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F)[Share on Telegram](https://t.me/share/url?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Ffilesystem%2F&text=filesystem)
# `codeweaver.core.utils.filesystem`
[Section titled “codeweaver.core.utils.filesystem”](#codeweavercoreutilsfilesystem)
Git and filesystem-related utility functions.

## Function: `get_git_branch`
[Section titled “Function: get_git_branch”](#function-get_git_branch)

**

```
get_git_branch()
```

Get the current branch name of a git repository.

## Function: `get_git_revision`
[Section titled “Function: get_git_revision”](#function-get_git_revision)

**

```
get_git_revision()
```

Get the SHA-1 of the HEAD of a git repository.

## Function: `get_project_path`
[Section titled “Function: get_project_path”](#function-get_project_path)

**

```
get_project_path()
```

Get the root directory of the project.

## Function: `get_tooling_dirs`
[Section titled “Function: get_tooling_dirs”](#function-get_tooling_dirs)

**

```
get_tooling_dirs()
```

Get common tooling directories within the project root.

## Function: `get_user_cache_dir`
[Section titled “Function: get_user_cache_dir”](#function-get_user_cache_dir)

**

```
get_user_cache_dir()
```

Get the user cache directory based on the operating system.

## Function: `get_user_config_dir`
[Section titled “Function: get_user_config_dir”](#function-get_user_config_dir)

**

```
get_user_config_dir()
```

Get the user configuration directory based on the operating system.

## Function: `get_user_data_dir`
[Section titled “Function: get_user_data_dir”](#function-get_user_data_dir)

**

```
get_user_data_dir()
```

Get the user data directory based on the operating system.

## Function: `get_user_state_dir`
[Section titled “Function: get_user_state_dir”](#function-get_user_state_dir)

**

```
get_user_state_dir()
```

Get the user state directory based on the operating system.

## Function: `has_git`
[Section titled “Function: has_git”](#function-has_git)

**

```
has_git()
```

Check if git is installed and available.

## Function: `in_codeweaver_clone`
[Section titled “Function: in_codeweaver_clone”](#function-in_codeweaver_clone)

**

```
in_codeweaver_clone()
```

Check if the current repo is CodeWeaver.

## Function: `is_git_dir`
[Section titled “Function: is_git_dir”](#function-is_git_dir)

**

```
is_git_dir()
```

Is the given directory version-controlled with git?

## Function: `normalize_ext`
[Section titled “Function: normalize_ext”](#function-normalize_ext)

**

```
normalize_ext()
```

Normalize a file extension to a standard format. Cached because of hot/repetitive use.

## Function: `set_relative_path`
[Section titled “Function: set_relative_path”](#function-set_relative_path)

**

```
set_relative_path()
```

Validates a path and makes it relative to the project root if the path is absolute.

## Function: `try_git_rev_parse`
[Section titled “Function: try_git_rev_parse”](#function-try_git_rev_parse)

**

```
try_git_rev_parse()
```

Attempt to use git to get the root directory of the current git repository.