Skip to content
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

UNC path name handling #345

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

schinagl
Copy link
Contributor

@schinagl schinagl commented Aug 29, 2022

Basic UNC path support

@schinagl schinagl marked this pull request as draft August 29, 2022 18:24
@schinagl schinagl force-pushed the unc_path_support branch 3 times, most recently from cbae804 to 1bbb914 Compare September 17, 2022 08:10
@schinagl
Copy link
Contributor Author

schinagl commented Sep 17, 2022

General

Basic UNC path support.
2022_09_17_16_59_15_File_Manager

How to use

One can

  • paste an UNC path via CTRL-G
  • select between up to 10 UNC path via 'virtual drives' either from
    ** drives drop down menu
    ** via CTRL-ALT-0..9
  • Close an UNC path by using CTRL-W

Works stable

Download

UNC support is available from my private branch and
64bit binary download
32bit binary download
W2K WXP binary download
I called this version 10.2.0.19. This is just my internal number.

@schinagl
Copy link
Contributor Author

schinagl commented Dec 5, 2022

Rebased onto 9525928

@schinagl schinagl force-pushed the unc_path_support branch 2 times, most recently from 60b9c23 to d0e6a1b Compare February 4, 2023 16:30
@schinagl schinagl marked this pull request as ready for review February 5, 2023 18:20
@schinagl
Copy link
Contributor Author

schinagl commented Feb 5, 2023

After a 5 month test, daily use and ironing out a few glitches lets make it ready for review.

This PR is a big one I know ;-) and it it really does changes with the innner hydraulics.
Surprisingly by doing a few key changes to

  • treectl.c:ReadDirLevel()
  • making DRIVEID a function (and the layout it stores things)
  • extending winfile.ini
  • and a few other related things ;-)

this really works well. Lets see if someone is brave enough to tackle with this one

@malxau
Copy link
Contributor

malxau commented Feb 6, 2023

Happy to look, although right now I'm not sure what I'm looking at...is there a Cliff's Notes summary of what's happening?

I could use Goto to launch a window in a UNC path. That doesn't seem to populate the drive list with a virtual drive though - how does the virtual drive logic work?

@schinagl
Copy link
Contributor Author

schinagl commented Feb 7, 2023

Added two convenience commits, because during development I didn't care

  • Avoid UNC loops: This does not allow a new UNC mapping for a path which is parent of a already mapped UNC path
  • Update drivelist after UNC (un)mapping: Update the drive list

64bit binary download
32bit binary download

Copy link
Contributor

@malxau malxau left a comment

Choose a reason for hiding this comment

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

I'm still going through these, but it seems useful to share the comments I have now.

src/lang/res_ja-JP.rc Outdated Show resolved Hide resolved
src/lang/res_ja-JP.rc Outdated Show resolved Hide resolved
src/winfile.h Show resolved Hide resolved
src/winfile.h Show resolved Hide resolved
@@ -104,7 +104,9 @@ INT atoiW(LPWSTR sz);
#define MAXMESSAGELEN (MAXPATHLEN * 2 + MAXSUGGESTLEN)

#define MAX_WINDOWS 27
Copy link
Contributor

Choose a reason for hiding this comment

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

This value seems very suspicious but it looks like the current code can handle multiple windows to the same drive. Do you know of any reason for this value?

Copy link
Contributor Author

@schinagl schinagl Feb 13, 2023

Choose a reason for hiding this comment

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

I didn't stumble across this one, but sure it points to the max number of open windows.
I assume with 10 numbered and 26 letter drives, we currently will not be able to have all open at the same time.

But they must have had similar problems, when one opened a second window to one drive, then you could also not have your favorite 'Z' drive shown.

But 27 windows open at the same time is too much anyhow. One can not handle this, so it is a limit i would live with.

// Search the list of slots if path would be parent of already existing drive == circularity
BOOL FindUNCLoop(LPCTSTR path)
{
for (DWORD dwDriveIndex = OFFSET_UNC; dwDriveIndex < MAX_DRIVES; ++dwDriveIndex) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please declare the variable at the start, C89 style.

(I know this sounds opinionated but I promise this is pure pragmatism - it lets the code compile with older compilers, allowing code to move back to the retro branch, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry no. We are in 2023 and applying a 34 year old coding style seems odd to me.

It makes things unreadable. One day we have to face the present ;-)

I know you need the old compiler for you W2K & WXP branch. Anyhow the whole Winfile has lots of C89 violations and also contains wfgoto.cpp which you have to exclude from the makefile to get it compiling.

So you have to anyhow change something, when you bring it to your branch. To ease your life you could start with https://github.com/schinagl/winfile/tree/malxau_hardlink_junctions which I took from you and made the whole hardlink/sysmlink stuff compile with C89.

Copy link
Contributor

Choose a reason for hiding this comment

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

Stepping back a bit, my motivation is to maximize the potential contributors and potential users of the project. Reasonable people can disagree how to best achieve those goals, but those goals underpin everything I'm doing in this project.

When I made the previous comment, I believed that #165 had removed C99 variable declarations and replaced them with C89, and C99 was being gradually reintroduced. After reviewing this and related PRs, it appears they never merged, which takes care of the core of my objection. Note these did not remove wfgoto; they attempted to use earlier C++ standards to support compiling on XP.

Reading the comments in the PRs though stings a bit, because it shows potential contributors being discouraged and openly giving up on the project. It's not surprising that a project like this would attract retro enthusiasts, and keeping a large group of contributors implies having people with different goals working together. I hope that you and I share that perspective: if we didn't, it would be easy enough to archive this repo, leaving it read only, and let anyone maintain their own fork with no collaboration. Working together means accepting that not everyone wants the same thing, but if we have enough overlap, we can still improve things for each other.

Copy link
Contributor Author

@schinagl schinagl Mar 13, 2023

Choose a reason for hiding this comment

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

So you mean that people do not develop on this repo because it is not in C89 ??? This is hilarious.

I am totally confused reading your above writing.
fyi: @craigwi

src/wfutil.c Outdated Show resolved Hide resolved
@schinagl
Copy link
Contributor Author

Any news here?
I use UNC since many month and it works really well without any glitch.
So how do we proceed?

@schinagl
Copy link
Contributor Author

schinagl commented Jun 2, 2023

Have you tried this branch?
It really works and I think it is a useful improvement

@craigwi: What do you think?

@schinagl schinagl force-pushed the unc_path_support branch from cf016eb to d332a7a Compare July 3, 2023 19:11
@schinagl
Copy link
Contributor Author

schinagl commented Aug 1, 2023

Any news here? Review results?

@craigwi
Copy link
Contributor

craigwi commented Aug 10, 2023

@schinagl, my suggestion is to refine this PR to avoid all reformatting unrelated to the UNC change and go with @malxau's requests on the necessary changes. It is more important to get the UNC functionality added and then have a separate discussion on formatting.

@schinagl
Copy link
Contributor Author

schinagl commented Aug 10, 2023

The original PR itself has no unnecessary reformatting, but yes I had to merge @malxau reformatting and beautifying into it because otherwise there would be conflicts and it would not merge for github.
( Except for FinditemFromPath which was changed heavily and at the end reformatted)

Sure I can put my changes on top of the master once @malxau is done with his beautifying PRs, so that you see the bare changes. (I am back on my computer by begin of September)

  • On the requested C89 changes by malxau: No I am not changing things in this PR to C89.
  • On the DRIVEID to DriveId change: yes we can do this at the very end, otherwise I would generate unnecessary diffs, which makes comparison more a mess.

@schinagl
Copy link
Contributor Author

schinagl commented Aug 27, 2023

Rebased onto #403 aka [28971f6]

Now the UNC changes are on top of all beautfying PRs

@schinagl
Copy link
Contributor Author

Any news here?
Have you tried it?
It is merged on top of the other changes. So what's left?

One can download binaries from here

@schinagl
Copy link
Contributor Author

schinagl commented Nov 4, 2023

Any news here?
Have you tried it?
It is merged on top of the other changes. So what's left?
@craigwi ?

One can download binaries from here

@craigwi
Copy link
Contributor

craigwi commented Nov 5, 2023

Hi @schinagl, I ran into a problem with a basic test. File.Goto Directory to a network share worked. Then running Disk.Select Drive shows two things, my C drive and the network share. That's fine.

The problem is that the items are reversed. When I select the c: drive, I get the network share and vice versa. The order in the dropdown list on the toolbar seems ok.

Next I when on my c: drive and use File.Goto Directory to the same network share, nothing happens; that is, the window doesn't change to the network share.

@schinagl
Copy link
Contributor Author

schinagl commented Nov 5, 2023

Thx for looking into it

The problem is that the items are reversed. When I select the c: drive, I get the network share and vice versa. The order in the dropdown list on the toolbar seems ok.

This is odd as it works on my side, but I have many drives, network drives and 3 UNC drives
Will try to reproduce
Anyhow: You are using the most recent version from the branch?
Does pressing F5 once after starting Winfile help? (Even if it is a bug, that you have to press F5)

Next I when on my c: drive and use File.Goto Directory to the same network share, nothing happens; that is, the window doesn't change to the network share.

Can confirm this. This wasn't a use-case on my side, but we can fix this
During my daily use, I create the drive once via File.Goto and then use CTRL-ALT so select
Anyhow will look into it

@schinagl
Copy link
Contributor Author

schinagl commented Nov 5, 2023

Fixed 2) from above:
Now one can type in a path which already had a UNC mapping and the window will be opened

Related: A limitation ever since was and will be: One can not UNC-map to a path, when it would be the parent of an already existing UNC mapping, e.g. \\foo\bar for existing UNC mapping \\foo\bar\share

Hermann Schinagl added 2 commits November 5, 2023 17:11
Take care of UNC drives beeing not the last window(s)
…ives after start of Winfile (F5 would heal this)
@schinagl
Copy link
Contributor Author

I have played a around quite a lot, use Winfile as all/every day file-manager

  • I fixed 3120383
    Next I when on my c: drive and use File.Goto Directory to the same network share, nothing happens; that is, the window doesn't change to the network share.
  • I fixed a issue, with closing an UNC window when it was open in more than once instance, but no other logical drive were open. So they were the last open windows. (4425547)
  • I fixed the problem with the drives drop down, when many drives were open ( it had to show a scrollbar), and not updating the UNC drives properly. (26669d1)

Unfortunatley I was not able to reproduce

  • The problem is that the items are reversed. When I select the c: drive, I get the network share and vice versa. The order in the dropdown list on the toolbar seems ok.

How did you get there? I tried it on a clean machine, with no drives, but only C: And whatever I tried I was not able to run into the problem.

Are you sure you took the most recent version? I had a similar glitch in February 4, when sorting was enabled in the .dlg files, but it must not. But this is long gone.

Did you recompile from this very branch?
You could also take a precomiled binary (10.2.0.19) from my branch 64bit binary download.
Can you send me a screenshot? Or a screen capture video how you ran into this?

I am really out of ideas, since, as usual with those things, it works flawlessly on my side.

@schinagl
Copy link
Contributor Author

schinagl commented Dec 5, 2023

I am leaving this Winfile Repo. See #411
You might get a Winfile with UNC support from https://github.com/schinagl/winfile/releases

@schinagl schinagl closed this Dec 5, 2023
@schinagl schinagl deleted the unc_path_support branch December 8, 2023 08:24
@schinagl schinagl restored the unc_path_support branch December 10, 2023 05:33
@schinagl schinagl reopened this Dec 28, 2023
…lus one.

E-.g. Going back from c:\ba via .. didn't result in showing c:\ on the left pane
This only affects the UNC capable version

(cherry picked from commit d81ee37)
@schinagl schinagl mentioned this pull request Mar 15, 2024
schinagl and others added 5 commits March 20, 2024 07:20
# Conflicts:
#	src/lang/res_ja-JP.rc
#	src/lang/winfile_de-DE.dlg
#	src/lang/winfile_he-IL.dlg
#	src/lang/winfile_ja-JP.dlg
#	src/lang/winfile_pl-PL.dlg
#	src/lang/winfile_tr-TR.dlg
#	src/lang/winfile_zh-CN.dlg
#	src/wfutil.c
@schinagl schinagl force-pushed the unc_path_support branch 3 times, most recently from ff5dd36 to 908c426 Compare June 7, 2024 20:38
# Conflicts:
#	src/wfgoto.cpp
#	src/wfinit.c
@dash-xd
Copy link

dash-xd commented Jun 23, 2024

i have had success with Disk > Connect to a network drive . is that the same thing as all this?

@schinagl
Copy link
Contributor Author

No. You connected a drive.

Please go to my fork

https://github.com/schinagl/winfile/releases

Take the UNC capable winfile from there: press CTRL-G and enter a UNC path where you are already authenticated.

schinagl added 2 commits July 21, 2024 06:21
(cherry picked from commit bd845d9c3751cae17f78f258e0f8dbe1288eaff5)
(cherry picked from commit 1553bb0)
(cherry picked from commit 812a489)
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.

4 participants