microsoft / winfile

Original Windows File Manager (winfile) with enhancements
MIT License
6.76k stars 699 forks source link

Symbolic Link, Hardlink and Junction creation is available via menu #352

Closed schinagl closed 1 year ago

schinagl commented 1 year ago

As mentioned this is the small part, which provides menu entries for symbolic/hardlink/junction creation

tokomio-sun commented 1 year ago

@clzls @craigwims

thank you for reviewing. I fixed full width '%' in Line 420.

Edit: and verbs are using different voices across these messages... Maybe 選択している or such is better?

I should fix.

FROM: 'ファイルを %s にリンクする'

TO: '%s にファイルをリンク中'

schinagl commented 1 year ago

@clzls @craigwims

thank you for reviewing. I fixed full width '%' in Line 420.

Edit: and verbs are using different voices across these messages... Maybe 選択している or such is better?

I should fix.

FROM: 'ファイルを %s にリンクする'

TO: '%s にファイルをリンク中'

If you think '%s にファイルをリンク中' is a better Japanese then, please change it. You can do it on your branch for #355, and we get it into master, once your branch is merged

craigwims commented 1 year ago

No, I don't have any insights into JAPANBEGIN and JAPANEND.

@schinagl, related to an earlier question about the difference between the control afforded by the menus and that of the drag/drop: I was not thinking of adding another menu item, but would like to consider restricting the drag/drop case to match the menu case. That is, use the logic on line 788 of wfdlgs2.c in the drag/drop code, which would simplify the cases.

schinagl commented 1 year ago

@craigwims please give a code snippet where you would like to place if (IsDirectory(pCopyInfo->pFrom)) otherwise we run in danger to talk about different things

As mentioned above the idea in general is: WFMoveCopyDriverThread() gets PCOPYINFO fully filled out from

As of now WFMoveCopyDriverThread() is prepared to handle a fully filed out PCOPYINFO properly for the new FUNC_xxxx

The 'menu coding' of this PR now also needs to out fill PCOPYINFO properly in wfdlgs2.c:788

Anyhow please give a code snippet on what you would like to change in detail, so I can give a better answer.

craigwims commented 1 year ago

Line 316 of wfdirsrc.c: instead of setting iShowBitmap to DROP_HARD unconditionally, set to DROP_JUNC when the source of the drag/drop is a directory. The case in treectl.c, line 2903 always uses DROP_JUNC since the source there is always a directory.

schinagl commented 1 year ago

I guess I got your point

What I understood

Your concern starts in wfcopy.c:2776 and wfcopy:2810, because FUNC_HARD is used with oper == OPER_MKDIR In prosa:

With the proposed change in wfdirsrc.c:316 to send FUNC_HARD or FUNC_JUNC according to the output of IsDirectory() the lines wfcopy.c:2776 and wfcopy:2810 could be deleted and thus would be more logical to an future developer.

Discussion

So we must do this in wfcopy:3495. But here things also will not work because

So

Conclusio

Give it a try in the compiler yourself, you will see this would not work. Or create lots of unneccessary effort. We have to live with this disguise of junctions as FUNC_HARD in wfcopy.c:2776 when they are dragged from the file-pane. But we should comment it.

craigwims commented 1 year ago

Doing a file system operation on each mouse move is not a good idea; agreed.

Looking at this further, and reflecting on your comments, the difference between _HARD and JUNC seems very, very small. Why do we have both since at the bottom they both call WFJunction() which does not take FUNC* as a parameter?

schinagl commented 1 year ago

In most places we need a distinction

In general I also wanted to separate this for readability and debug-ability. The only place where it didn't work out, was wfcopy.c:2776 where a Junction disguises as FUNC_HARD, when it comes from the file-pane

schinagl commented 1 year ago

Did my answers help? Is it good to go or do you need more time to try it out?

craigwims commented 1 year ago

A refinement of my idea above: use the logic at line 788 in wfdlgs2.c at line 3506 in wfcopy.c. In this case, we don't need DROP_HARD (always use DROP_JUNC), but we do need FUNC_HARD .vs. FUNC_JUNC.

This will also make the drag/drop from the right and left pane be the same; as noted above, there is a difference because the left pane contains only directories.

schinagl commented 1 year ago

Discussion

Please read my comment from above, I discussed this way already:

This does not work because (the most important of many reason)

Please try this in the compiler yourself!

There are many other reasons from here and additionally:

Summary

schinagl commented 1 year ago

But maybe there is a more radical way .... Trying out things ....

schinagl commented 1 year ago

The point of my above argument was IsDirectory() on many This would not work

But more radical .... If we

then things work. IsDirectory() on many is not needed, that's the key point

The drag and drop loop is now more symetrical between tree and file but many other places are not so obvious to understand.

Anyhow it works.