Re: dmd as a library

2022-11-09 Thread Dennis via Digitalmars-d-learn
On Tuesday, 8 November 2022 at 05:48:54 UTC, vushu wrote: Ah thanks that's nice to have some examples. Here's an example of tools using dmd as a library: https://github.com/jacob-carlborg/dlp

Re: Passing a string by reference

2022-11-09 Thread IGotD- via Digitalmars-d-learn
On Tuesday, 8 November 2022 at 12:43:47 UTC, Adam D Ruppe wrote: In fact, ref in general in D is a lot more rare than in languages like C++. The main reason to use it for arrays is when you need changes to the length to be visible to the caller... which is fairly rare. In general many par

dirEntries removes entire branches of empty directories

2022-11-09 Thread Ali Çehreli via Digitalmars-d-learn
In case it matters, the file system is ext4. 1) Create a directory: mkdir deleteme and then run the following program: import std; void main() { foreach (e; dirEntries(absolutePath("./deleteme"), SpanMode.breadth)) { writeln(e.name); } } Understandably, the top level direct

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: Running the program shows no output; 'a' is not visited as a directory entry. That's not what happens for me: ```d import std.exception; import std.file; import std.path; import std.stdio; void ls() { foreach (e; dirEntries

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread kdevel via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: In case it matters, the file system is ext4. My code runs in tmp (tmpfs). 2) Make a sub-directory: mkdir deleteme/a Running the program shows no output; 'a' is not visited as a directory entry. Was say strace/ltrace? ``

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: In case it matters, the file system is ext4. 1) Create a directory: [...] That's not the behaviour I get in Windows. When I create the subdirectory, I see it even if it's empty

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Ali Çehreli via Digitalmars-d-learn
On 11/9/22 11:48, Imperatorn wrote: > That's not the behaviour I get in Windows. Windows users deserve it! :p (At least it is better in this case. :) ) > When I create the subdirectory, I see it even if it's empty struct DirIteratorImpl has different implementations for Windows, etc. Ali

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Ali Çehreli via Digitalmars-d-learn
On 11/9/22 11:05, Ali Çehreli wrote: > Can you think of a workaround to achieve that? Me, me, me! :) I've learned about the Posix function 'nftw' (but I am using its sibling 'ftw'). It was pretty easy to use but there is a quality issue there: They failed to support a 'void*' context for the

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 20:06:15 UTC, Ali Çehreli wrote: On 11/9/22 11:05, Ali Çehreli wrote: It was pretty easy to use but there is a quality issue there: They failed to support a 'void*' context for the user! You can walk the tree but can't put the results into your local context!

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:59:57 UTC, Ali Çehreli wrote: On 11/9/22 11:48, Imperatorn wrote: > That's not the behaviour I get in Windows. Windows users deserve it! :p (At least it is better in this case. :) ) > When I create the subdirectory, I see it even if it's empty struct DirI

Re: dmd as a library

2022-11-09 Thread vushu via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 11:45:46 UTC, Dennis wrote: On Tuesday, 8 November 2022 at 05:48:54 UTC, vushu wrote: Ah thanks that's nice to have some examples. Here's an example of tools using dmd as a library: https://github.com/jacob-carlborg/dlp Thanks, much appreciated 😊