Skip to content

fix: sidebar disk listing #708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 26, 2025
Merged

fix: sidebar disk listing #708

merged 8 commits into from
Mar 26, 2025

Conversation

wassup05
Copy link
Contributor

Closes #692

// exclude timemachine
if strings.HasPrefix(dir, "/Volumes/.timemachine") {
if strings.HasPrefix(path, "/Volumes/.timemachine") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont this understand how that could fix the issue .

If the "path" has this prefix, which is a directory, the "filepath.Dir(path)" would also have that prefix always.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily, like in my case I mounted my pen drive on /mnt and I saw that filepath.Dir returned / which does not have the same prefix as /mnt (/mnt is the required prefix here)

This happens because the function returned Mountpoint as /mnt and not /mnt/
Basically it thought that mnt is a file which it is not here. (docs)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Makes sense. But this might/might not fix it for windows. Need to test

@lazysegtree
Copy link
Collaborator

I am out this weekend. Will try to test this out Mon/Tue

@lazysegtree
Copy link
Collaborator

image

Doesn't seems to be working on windows.

@lazysegtree
Copy link
Collaborator

lazysegtree commented Mar 17, 2025

image

I dont know what happened, but the first \ was C: and second \ was D:, and when I pressed enter while selecting third \, my entire windows VM froze.

@wassup05
Copy link
Contributor Author

wassup05 commented Mar 17, 2025

I have added a commit, please let me know the name of the drive spf is freezing on

@lazysegtree
Copy link
Collaborator

lazysegtree commented Mar 18, 2025

image

Partitions

time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="disk.Partitions() called" "number of parts"=11
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=/dev/disk3s1s1 mountpoint=/ fstype=apfs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=devfs mountpoint=/dev fstype=devfs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=/dev/disk3s6 mountpoint=/System/Volumes/VM fstype=apfs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=/dev/disk3s2 mountpoint=/System/Volumes/Preboot fstype=apfs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=/dev/disk3s4 mountpoint=/System/Volumes/Update fstype=apfs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=/dev/disk1s2 mountpoint=/System/Volumes/xarts fstype=apfs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=/dev/disk1s1 mountpoint=/System/Volumes/iSCPreboot fstype=apfs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=/dev/disk1s3 mountpoint=/System/Volumes/Hardware fstype=apfs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=/dev/disk3s5 mountpoint=/System/Volumes/Data fstype=apfs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device="map auto_home" mountpoint=/System/Volumes/Data/home fstype=autofs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=/dev/disk3s3 mountpoint=/Volumes/Recovery fstype=apfs
time=2025-03-18T06:47:27.390+05:30 level=DEBUG msg="model.View() called"


➜  ~/Workspace/kuknitin/superfile git:(main) [6:29:22] mount
/dev/disk3s1s1 on / (apfs, sealed, local, read-only, journaled)
devfs on /dev (devfs, local, nobrowse)
/dev/disk3s6 on /System/Volumes/VM (apfs, local, noexec, journaled, noatime, nobrowse)
/dev/disk3s2 on /System/Volumes/Preboot (apfs, local, journaled, nobrowse)
/dev/disk3s4 on /System/Volumes/Update (apfs, local, journaled, nobrowse)
/dev/disk1s2 on /System/Volumes/xarts (apfs, local, noexec, journaled, noatime, nobrowse)
/dev/disk1s1 on /System/Volumes/iSCPreboot (apfs, local, journaled, nobrowse)
/dev/disk1s3 on /System/Volumes/Hardware (apfs, local, journaled, nobrowse)
/dev/disk3s5 on /System/Volumes/Data (apfs, local, journaled, nobrowse, protect, root data)
map auto_home on /System/Volumes/Data/home (autofs, automounted, nobrowse)
/dev/disk3s3 on /Volumes/Recovery (apfs, local, journaled, nobrowse)
➜  ~/Workspace/kuknitin/superfile git:(main) [6:30:14]

MacOS behaviour has changed. It didn't used to show /dev . I have added some logs, trying to look into it.

@lazysegtree
Copy link
Collaborator

lazysegtree commented Mar 18, 2025

Linux.
image

I need to have more understanding of partitions, mounts, and how exactly this disk.Partition() function is working. Going down the rabbithole

@lazysegtree
Copy link
Collaborator

Also, I am thinking that the main disk should always be listed under disks section.

@wassup05
Copy link
Contributor Author

What did you conclude? Can you summarize it for me @lazysegtree

@lazysegtree
Copy link
Collaborator

@wassup05 Not concluded anything yet. Working on it.

@lazysegtree
Copy link
Collaborator

lazysegtree commented Mar 19, 2025

Rebased with main

@lazysegtree
Copy link
Collaborator

Another issue

For windows we get this

time=2025-03-19T20:00:25.244+05:30 level=DEBUG msg="disk.Partitions() called" "number of parts"=3
time=2025-03-19T20:00:25.244+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=C: mountpoint=C: fstype=NTFS
time=2025-03-19T20:00:25.244+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=D: mountpoint=D: fstype=UDF
time=2025-03-19T20:00:25.244+05:30 level=DEBUG msg="Returned disk by disk.Partition()" device=Z: mountpoint=Z: fstype=FAT

So location would be "C:" but cd to "C:" will not work as you can see below

Hence, in windows, we need to attach \ to the mountpoint

PS C:\Users\nitin\Documents\Programming\wassup05\superfile> cd C:
PS C:\Users\nitin\Documents\Programming\wassup05\superfile>

…ws, always list root disk, keep isExternalDiskPath mostly untouched
// if you dont define the source path to compare with
// But making this true will cause slow file operations based on current implementation
if runtime.GOOS == "windows" {
return false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This retains existing behaviour in windows

@lazysegtree
Copy link
Collaborator

@wassup05 Check now.

yorukot
yorukot previously approved these changes Mar 21, 2025
@wassup05
Copy link
Contributor Author

Looks good to me @lazysegtree, Thank you. just a comment to add the /Volumes/.timemachine (return false) to the shouldListDisk too since that is not supposed to be shown

@lazysegtree
Copy link
Collaborator

Okay. Noted.

Also will wait for this for a while before merging - #692 (comment)

@lazysegtree
Copy link
Collaborator

Fixed @wassup05 's comments.

@lazysegtree
Copy link
Collaborator

image

@lazysegtree
Copy link
Collaborator

In windows there is still a problem, the drive names are no being shown. Need to fix that.

@wassup05
Copy link
Contributor Author

yeah, the filepath.Base throws away the Volumename from the path, so that would require a function with runtime.GOOS check as well

@lazysegtree
Copy link
Collaborator

image

Works on windows as well now.

@lazysegtree
Copy link
Collaborator

image Mac

@lazysegtree
Copy link
Collaborator

image

Linux

@lazysegtree lazysegtree merged commit 74c1cc6 into yorukot:main Mar 26, 2025
2 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Apr 20, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [yorukot/superfile](https://github.com/yorukot/superfile) | minor | `v1.1.7` -> `v1.2.1` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>yorukot/superfile (yorukot/superfile)</summary>

### [`v1.2.1`](https://github.com/yorukot/superfile/releases/tag/v1.2.1)

[Compare Source](yorukot/superfile@v1.1.7.1...v1.2.1)

#### Install:

[**Click me to know how to install**](https://github.com/yorukot/superfile?tab=readme-ov-file#installation)

#### Changelog

##### Update

-   Add show_image_preview flag [`#728`](yorukot/superfile#728)
-   Allow specifying directory icon color in theme files [`#709`](yorukot/superfile#709)
-   \--hotkey-file flag and fix in configFileFlag [`#700`](yorukot/superfile#700)
-   File preview: Add bat as plugin [`#686`](yorukot/superfile#686)
-   Monokai Theme [`#673`](yorukot/superfile#673)

##### Bug fix

-   Fix broken link in website causing 404 [`#714`](yorukot/superfile#714)
-   Fix sidebar disk listing [`#708`](yorukot/superfile#708)
-   Switch to semver for newer 1.2.1 release [`#687`](yorukot/superfile#687)

##### Optimization

-   Fix: icon consts [`#719`](yorukot/superfile#719)
-   Refactor and unit tests for scrolling [`#710`](yorukot/superfile#710)
-   Refactor of wheel functions [`#695`](yorukot/superfile#695)

##### Documentation

-   Add info about auto update [`#721`](yorukot/superfile#721)
-   add cd_on_quit for fish shell [`#696`](yorukot/superfile#696)
-   Add Pixi installation instructions [`#690`](yorukot/superfile#690)

#### New Contributors

-   [@&#8203;nkxxll](https://github.com/nkxxll) made their first contribution in yorukot/superfile#689
-   [@&#8203;apcamargo](https://github.com/apcamargo) made their first contribution in yorukot/superfile#690

**Full Changelog**: yorukot/superfile@v1.2.0.0...v1.2.1

Assets will be generated after version change MRs are merged

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMjIuMyIsInVwZGF0ZWRJblZlciI6IjM5LjIyMi4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues while listing Mounted Disks
3 participants