currently ND tries to rewrite the Global Topics.txt this behavious is not always wanted, for exemple if the ND is installed in /usr/share ...
thank you in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just submitted a bug report about this same issue - my problem was that I was running ND as another user.
I hope someone can post a workaround (apart from "chmod 777 Topics.txt", which I don't want to do...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In Topics.pm at line 767 (function SaveFile) it states:
if (NaturalDocs::ConfigFile->Open($file))
{
# We can assume the file is valid.
....
Change this to:
if (NaturalDocs::ConfigFile->Open($file))
{
# We can assume the file is valid.
if ($isMain)
{
# If not ok, you get the could not save error.
return;
}
The same for the function SaveFile in Languages.pm at line 857, is states:
if ($version = NaturalDocs::ConfigFile->Open($file))
{
# We can assume the file is valid.
...
Change this to:
if ($version = NaturalDocs::ConfigFile->Open($file))
{
# We can assume the file is valid.
if ($isMain)
{
# If not ok, you get the could not save error.
return;
}
That does the trick for me. Don't know if Greg agrees with 'fixing' it like this, but so far it works for me just fine.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's a hack, and I hope Greg doesn't accept it. No offense, but commenting out the "$self->SaveFile(1); # Main" code works just as well, and invloves less typing. Plus, your "return" means you're returning in the middle of whatever it is that subroutine was doing. Might cause a mess.
I think the underlying problem is that the code tries to automatically change a global configuration file, instead of only a project file. I've never seen it done this way, for good reason I suspect...
Global conf files should be edited by seperate processes, not by everyday, run-of-the-mill project creation procedures. Those should only touch project configuration files.
Just my 2 cents worth.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yep, commenting the $self->SaveFile(1) works also, but also eliminates the checks performed on the files. I guess your suggestion is better, but then you have to make sure that the main config files are ok, no type errors etc.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The extra file save is just the reformatter, it isn't really necessary. I wasn't aware it could cause problems.
What happens when it tries to save? Does ND fail with "Couldn't save [file]" or does some other behavior occur instead? If the former, then I can have it just ignore the error with the main files and keep going. If the latter, it looks like I may need another command line option, which I'd like to avoid if possible.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem is the 'Could not save'. I maintain some make scripts to compile our sources, run Natural Docs etc. We keep our sources in SourceSafe, this sets the read-only flag on files that are not checked out. The project developers cannot checkout the main Topics.txt and Lanuguages.txt files.
What I did initially is remove the read-only flag, run Natural Docs and then set the read-only flag. But that is not really correct, because it would also set the read-only flag if i have the files checked out. This also seems to confuse SourceSafe somehow if i do not have the files checked out, it sees the timestamp of the files are different.
If commenting the SaveFile(1) still performs the checks on these files, without the saving, that is ok for me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
it would be nice if a permissions checking was done before trying to reformat the files, and it would throw the error only if the project files are not writable, not the global ones ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
currently ND tries to rewrite the Global Topics.txt this behavious is not always wanted, for exemple if the ND is installed in /usr/share ...
thank you in advance
I just submitted a bug report about this same issue - my problem was that I was running ND as another user.
I hope someone can post a workaround (apart from "chmod 777 Topics.txt", which I don't want to do...
In Topics.pm at line 767 (function SaveFile) it states:
if (NaturalDocs::ConfigFile->Open($file))
{
# We can assume the file is valid.
....
Change this to:
if (NaturalDocs::ConfigFile->Open($file))
{
# We can assume the file is valid.
if ($isMain)
{
# If not ok, you get the could not save error.
return;
}
The same for the function SaveFile in Languages.pm at line 857, is states:
if ($version = NaturalDocs::ConfigFile->Open($file))
{
# We can assume the file is valid.
...
Change this to:
if ($version = NaturalDocs::ConfigFile->Open($file))
{
# We can assume the file is valid.
if ($isMain)
{
# If not ok, you get the could not save error.
return;
}
That does the trick for me. Don't know if Greg agrees with 'fixing' it like this, but so far it works for me just fine.
> That does the trick for me.
It's a hack, and I hope Greg doesn't accept it. No offense, but commenting out the "$self->SaveFile(1); # Main" code works just as well, and invloves less typing. Plus, your "return" means you're returning in the middle of whatever it is that subroutine was doing. Might cause a mess.
I think the underlying problem is that the code tries to automatically change a global configuration file, instead of only a project file. I've never seen it done this way, for good reason I suspect...
Global conf files should be edited by seperate processes, not by everyday, run-of-the-mill project creation procedures. Those should only touch project configuration files.
Just my 2 cents worth.
Yep, commenting the $self->SaveFile(1) works also, but also eliminates the checks performed on the files. I guess your suggestion is better, but then you have to make sure that the main config files are ok, no type errors etc.
The extra file save is just the reformatter, it isn't really necessary. I wasn't aware it could cause problems.
What happens when it tries to save? Does ND fail with "Couldn't save [file]" or does some other behavior occur instead? If the former, then I can have it just ignore the error with the main files and keep going. If the latter, it looks like I may need another command line option, which I'd like to avoid if possible.
The problem is the 'Could not save'. I maintain some make scripts to compile our sources, run Natural Docs etc. We keep our sources in SourceSafe, this sets the read-only flag on files that are not checked out. The project developers cannot checkout the main Topics.txt and Lanuguages.txt files.
What I did initially is remove the read-only flag, run Natural Docs and then set the read-only flag. But that is not really correct, because it would also set the read-only flag if i have the files checked out. This also seems to confuse SourceSafe somehow if i do not have the files checked out, it sees the timestamp of the files are different.
If commenting the SaveFile(1) still performs the checks on these files, without the saving, that is ok for me.
it would be nice if a permissions checking was done before trying to reformat the files, and it would throw the error only if the project files are not writable, not the global ones ...
This is fixed by downloading Patch 3 from SourceForge.
thank you very much