[En-Nut-Discussion] qnutconf path mysteries
Harald Kipp
harald.kipp at egnite.de
Tue Dec 8 17:47:29 CET 2009
Thiago A. Corrêa wrote:
> On Tue, Dec 8, 2009 at 9:52 AM, Harald Kipp <harald.kipp at egnite.de> wrote:
>> start searching at the installation directory and stop searching as soon
>> as they find
>>
>> C:\ethernut-4.9\crossworks\nut\...
>>
>> which is just a temporary directory containing a few patches, but no
>> conf directory.
>>
>
> It must contain an os/version.c in that path, as that's what it looks
> for, like nutconf. We could simplify and look for conf/repository.nut
> but then if you had a temporary directory containing that file, the
> same thing would happen.
Well, but your code tells a different story :-)
if ( folder.contains( nutFolder ) )
{
QDir nut( folder );
if ( nut.exists( filename ) )
return QDir::current().relativeFilePath( QDir( folder
).absoluteFilePath( filename ) );
else
return QString();
}
As soon as the path currently searched contains "/nut/", then
findRelativePathDepthSearch will return, even if filename doesn't exist.
>> I'm not yet sure how to fix this in a right way, because ...
>
> Does it needs fixing? I'm not sure if this situation needs fixing?
It does. Consider an application which contains a subdirectory nut.
Try the following test case on your machine. Create the normal tree, e.g.
C:\ethernut-4.8.5\nut
C:\ethernut-4.8.5\apps
C:\ethernut-4.8.5\blds
Make sure the app dir is called apps, not nutapp, so it will be searched
before nut.
Now create a new directory
C:\ethernut-4.8.5\apps\myapp\nut\test
and try the qnutconf.
> Although in practice a single configurator *could* work with any
> version of Nut/OS, this might not be always true, and I belive
> shouldn't be officially supported. I think (q)nutconf should be run
> directly below the nut folder containing sources.
I'm typically using the latest Configurator for all trees. So far it
seems to be fully backward compatible.
But in general: Yes. In order to play safe, the exec that came with the
specific distribution should be used.
> (lua script needs to figure out
> the compiler for example, that could be nice)
Why not, sounds cool.
> Running from c:\Ethernut-x.y.z should work fine.
Again your code tells a different story. :-)
if ( QDir::current().absolutePath().contains(
QRegExp("[\\\\/]nut[\\\\/]") ) )
in findRelativePath will evaluate to false, because there is no "\nut\"
in "c:\Ethernut-x.y.z".
then
current.cdUp();
will make sure, that the loop
while ( !current.isRoot() )
is not executed, because c:\Ethernut-x.y.z\.. is already the root. So
findRelativePath will return an empty string and
repositoryFile = srcpath + "/conf/repository.nut";
evaluates to "/conf/repository.nut".
> About the "allow multiple configurations" I agree. It doesn't work
> propery at all (nutconf).
Note, that it had been provided by Christian Welzel 3 years ago as a
quick solution. It doesn't work well, but survived already 3 years and I
won't miss it. Often I'm changing between several platforms many times a
day.
> the other hand, the compiler settings is more anoying. If you have
> boards with atmega and arm or atmega and uc3 (different boards,
> different confs), then whenever you need to build for another board,
> you need to change the compiler settings.
You mean with "allow multiple configurations" enabled, you still need to
update the settings manually? This works fine here.
Harald
More information about the En-Nut-Discussion
mailing list