refactor output file name generation #1513

Merged
merged 1 commit into from Jan 20, 2013

Conversation

Projects
None yet
3 participants
@WalterBright
Member

WalterBright commented Jan 19, 2013

Lots of duplicated code removed.

@ghost

View changes

src/module.c
+ * name Command line name given for the file, NULL if none
+ * dir Command line directory given for the file, NULL if none
+ * ext File name extension to use if 'name' is NULL
+ * arg Name of the source file

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Jan 19, 2013

Please swap this with the line above to avoid confusion (ext is followed by arg in param list, not the other way around).

@ghost

ghost Jan 19, 2013

Please swap this with the line above to avoid confusion (ext is followed by arg in param list, not the other way around).

This comment has been minimized.

Show comment Hide comment
@WalterBright

WalterBright Jan 20, 2013

Member

ok

WalterBright added a commit that referenced this pull request Jan 20, 2013

Merge pull request #1513 from WalterBright/b17
refactor output file name generation

@WalterBright WalterBright merged commit 73b3b2e into dlang:master Jan 20, 2013

1 check passed

default Pass: 10
Details

@WalterBright WalterBright deleted the WalterBright:b17 branch Jan 20, 2013

WalterBright added a commit that referenced this pull request Jan 20, 2013

@denis-sh

This comment has been minimized.

Show comment Hide comment
@denis-sh

denis-sh Jan 24, 2013

Contributor

@WalterBright, this is not a refactoring. This pull puts all generated DI files in current directory (i.e. no respect to -Hd, try build SciD for example). Revert or fix it please as importing a directory with generated DI files doesn't work any more.

Contributor

denis-sh commented Jan 24, 2013

@WalterBright, this is not a refactoring. This pull puts all generated DI files in current directory (i.e. no respect to -Hd, try build SciD for example). Revert or fix it please as importing a directory with generated DI files doesn't work any more.

@WalterBright

This comment has been minimized.

Show comment Hide comment
@WalterBright

WalterBright Jan 24, 2013

Member

What is the command you are passing to dmd?

Member

WalterBright commented Jan 24, 2013

What is the command you are passing to dmd?

@MartinNowak

This comment has been minimized.

Show comment Hide comment
@MartinNowak

MartinNowak Jan 24, 2013

Member

-Hd works for me.

echo "void foo() {}" > foo.d
mkdir bar
dmd -c -Hdbar foo
cat bar/foo.di
rm -r foo.d bar
Member

MartinNowak commented Jan 24, 2013

-Hd works for me.

echo "void foo() {}" > foo.d
mkdir bar
dmd -c -Hdbar foo
cat bar/foo.di
rm -r foo.d bar
@denis-sh

This comment has been minimized.

Show comment Hide comment
@denis-sh

denis-sh Jan 24, 2013

Contributor

OK, I was incorrect. It changed behavior only if both -Hd and -Hf are passed (like SciD's buid.d does):

dmd -c -Hdbar -Hfmy.foo.di foo.d

Previously it created .\bar\my.foo.di, now it creates .\my.foo.di

Contributor

denis-sh commented Jan 24, 2013

OK, I was incorrect. It changed behavior only if both -Hd and -Hf are passed (like SciD's buid.d does):

dmd -c -Hdbar -Hfmy.foo.di foo.d

Previously it created .\bar\my.foo.di, now it creates .\my.foo.di

@WalterBright

This comment has been minimized.

Show comment Hide comment
@WalterBright

WalterBright Jan 24, 2013

Member

That's what I suspected. As I refactored, I discovered that every output file followed different rules. This is a terrible situation. They still aren't all harmonized, but I intend to get them to all follow the same rules.

In this case, the idea that if you specify an output file name, that name should trump everything, including the directory. If you want a directory for the output file name, put it on the name:

dmd -c -Hfbar\my.foo.di foo.d

The -Hd only applies when the name itself is generated.

Member

WalterBright commented Jan 24, 2013

That's what I suspected. As I refactored, I discovered that every output file followed different rules. This is a terrible situation. They still aren't all harmonized, but I intend to get them to all follow the same rules.

In this case, the idea that if you specify an output file name, that name should trump everything, including the directory. If you want a directory for the output file name, put it on the name:

dmd -c -Hfbar\my.foo.di foo.d

The -Hd only applies when the name itself is generated.

@denis-sh

This comment has been minimized.

Show comment Hide comment
@denis-sh

denis-sh Jan 24, 2013

Contributor

I mean it is a breaking change without any note or proper documentation.

Contributor

denis-sh commented Jan 24, 2013

I mean it is a breaking change without any note or proper documentation.

@WalterBright

This comment has been minimized.

Show comment Hide comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment