Fix regression introduced in 1.3.37 where the default output directory for target language specific files (in the absence of -outdir) was no longer the same as the generated c/c++ file

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11093 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-01-29 19:25:37 +00:00
commit 90ab280f90
4 changed files with 25 additions and 5 deletions

View file

@ -1,6 +1,11 @@
Version 1.3.38 (in progress)
================================
2008-01-29: wsfulton
Fix regression introduced in 1.3.37 where the default output directory
for target language specific files (in the absence of -outdir) was no
longer the same directory as the generated c/c++ file.
2008-01-28: wsfulton
[Java, C#] Fix proxy class not being used when the global scope operator
was used for parameters passed by value. Reported by David Piepgrass.

View file

@ -860,8 +860,8 @@ that split the task up into converting
the C bit patterns (integer or bit set)
into Modula-3 bit patterns (integer or bit set)
and change the type as requested.
See the corresponding
<a href="../../Examples/modula3/enum/example.i">example</a>.
See the corresponding example in the
Examples/modula3/enum/example.i file.
This is quite messy and not satisfying.
So the best what you can currently do is
to rewrite constant definitions manually.
@ -877,8 +877,8 @@ that I'd like to automate.
Declarations of C++ classes are mapped to <tt>OBJECT</tt> types
while it is tried to retain the access hierarchy
"public - protected - private" using partial revelation.
Though the
<a href="../../Examples/modula3/class/example.i">implementation</a>
Though the example in
Examples/modula3/class/example.i
is not really useful, yet.
</p>

View file

@ -247,6 +247,17 @@ cppfiles/example_wrap.cpp
pyfiles/example.py
</pre></div>
<p>
If the <tt>-outcurrentdir</tt> option is used (without <tt>-o</tt>)
then SWIG behaves like a typical C/C++
compiler and the default output directory is then the current directory. Without
this option the default output directory is the path to the input file.
If <tt>-o</tt> and
<tt>-outcurrentdir</tt> are used together, <tt>-outcurrentdir</tt> is effectively ignored
as the output directory for the language files is the same directory as the
generated C/C++ file if not overidden with <tt>-outdir</tt>.
</p>
<H3><a name="SWIG_nn5"></a>5.1.3 Comments</H3>

View file

@ -273,15 +273,18 @@ static unsigned int decode_numbers_list(String *numlist) {
static void set_outdir(const String *c_wrapper_file_dir) {
Printf(stdout, "outdir (10): %s\n", outdir);
// Add file delimiter if not present in output directory name
if (outdir && Len(outdir) != 0) {
const char *outd = Char(outdir);
if (strcmp(outd + strlen(outd) - strlen(SWIG_FILE_DELIMITER), SWIG_FILE_DELIMITER) != 0)
Printv(outdir, SWIG_FILE_DELIMITER, NIL);
}
Printf(stdout, "outdir (20): %s\n", outdir);
// Use the C wrapper file's directory if the output directory has not been set by user
if (!outdir)
outdir = NewString(c_wrapper_file_dir);
Printf(stdout, "outdir (30): %s\n", outdir);
}
/* This function sets the name of the configuration file */
@ -1162,6 +1165,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
Setattr(top, "inputfile", input_file);
char *basename = Swig_file_basename(outcurrentdir ? Swig_file_filename(infile): Char(infile));
Printf(stdout, "basename: %s\n", basename);
if (!outfile_name) {
if (CPlusPlus || lang->cplus_runtime_mode()) {
Setattr(top, "outfile", NewStringf("%s_wrap.%s", basename, cpp_extension));
@ -1176,7 +1180,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
} else {
Setattr(top, "outfile_h", outfile_name_h);
}
set_outdir(Swig_file_dirname(basename));
set_outdir(Swig_file_dirname(Getattr(top, "outfile")));
if (Swig_contract_mode_get()) {
Swig_contracts(top);
}