On Fri, Jun 30, 2017 at 12:50:24PM +0000, FoxyBrown via Digitalmars-d-learn 
wrote:
> I am using dirEntries to iterate over files to rename them.
> 
> I am renaming them in a loop(will change but added code for testing).
> 
> 
> In DMD the renaming works but in LDC the renaming fails. It fails in a
> way that I can't quite tell and I cannot debug because visual D is not
> working properly for LDC.
> 
> The code essentially look like the following:
> 
> 
>       auto dFiles = dirEntries(loc, mask, _mode);
>       
>       foreach (d; dFiles)
>       {               
> 
>            auto newName = Recompute(d.name)
>            writeln(newName);
>            rename(d.name, newName);
>         }
> 
> but when I comment out rename, it works under LDC.
> 
> The funny thing is, newName is printed wrong so Recompute is effected
> by the rename.
> 
> This shouldn't occur.
[...]

This sounds very strange.  What exactly do you mean by "newName is
printed wrong"? Do you mean that somehow it's getting affected by the
*subsequent* rename()?  That would be truly strange.  Or do you mean
that newName doesn't match what you expect Recompute to do given d.name?
Perhaps you should also print out d.name along with newName just to be
sure?

Do you have a reduced code example that's compilable/runnable?  It's
rather hard to tell what's wrong based on your incomplete snippet.


T

-- 
An imaginary friend squared is a real enemy.

Reply via email to