Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
OpenOffice.org from the commandline
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Tanktalus
Tux's lil' helper
Tux's lil' helper


Joined: 27 Apr 2005
Posts: 86

PostPosted: Sun Jan 27, 2008 3:17 pm    Post subject: OpenOffice.org from the commandline Reply with quote

Since upgrading to 2.3.1, I've been having problems opening new documents in an existing openoffice.org session from the commandline.

That is, if I run "oowrite foo.doc" when OOo isn't running, it's fine. But if I run "oowrite foo.doc" when OOo already is running, then I get a message that "/usr/lib/openoffice/program/foo.doc does not exist" - but my current working directory is not /usr/lib/openoffice/program, it's ~/Documents or whatever.

If I run 'oowrite "`pwd`"/foo.doc', then it works fine (the extra double quotes around `pwd` are for when `pwd` has spaces in it).

Note that this problem did not exist in 2.3.0 (which isn't in portage anymore, so downgrading, while possible, is much harder).

I'm not sure if it's a problem here (emerge went wrong), in the ebuild (e.g., one of the patches), or in OOo itself.

Has anyone else noticed this? Is there a fix?
Back to top
View user's profile Send private message
S3tH
n00b
n00b


Joined: 09 Dec 2005
Posts: 13

PostPosted: Sun Jan 27, 2008 3:36 pm    Post subject: Reply with quote

I have the same issue although I can't seem to get around the error by changing the quotes like you did.

However, I was able to get around the problem by changing the command a bit:

From:
oowriter "iAudio Instructions.odt"
To:
ooffice -writer "iAudio Instructions.odt"

It seems strange to me that this switch works considering it should just be calling to the same thing.

Good Luck!
Back to top
View user's profile Send private message
tld
Veteran
Veteran


Joined: 09 Dec 2003
Posts: 1816

PostPosted: Sun Jan 27, 2008 3:56 pm    Post subject: Reply with quote

That's a really odd one. I'm running 2.3.1 and can't duplicate that behavior at all. It works fine for me opening up multiple documents from different directories with oowriter. Apparently oowriter is just a script:

Code:
cat `which oowriter`
#!/bin/sh

cmd=`dirname "$0"`/soffice
exec "$cmd" -writer "$@"


There's nothing in there that would change the working directory.

Unless I'm missing something however, there's no need to use either "oowriter" or "ooffice -writer" instead of just "ooffice" when opening an existing document, as ooffice knows what to do with it. That's all I've ever used.

Tom
Back to top
View user's profile Send private message
Tanktalus
Tux's lil' helper
Tux's lil' helper


Joined: 27 Apr 2005
Posts: 86

PostPosted: Sun Jan 27, 2008 9:37 pm    Post subject: Reply with quote

tld wrote:
That's a really odd one. I'm running 2.3.1 and can't duplicate that behavior at all. It works fine for me opening up multiple documents from different directories with oowriter. Apparently oowriter is just a script:

Code:
cat `which oowriter`
#!/bin/sh

cmd=`dirname "$0"`/soffice
exec "$cmd" -writer "$@"


There's nothing in there that would change the working directory.

Unless I'm missing something however, there's no need to use either "oowriter" or "ooffice -writer" instead of just "ooffice" when opening an existing document, as ooffice knows what to do with it. That's all I've ever used.

Tom


Oddly enough, that's not what my oowriter looks like.

Code:
cat `which oowriter`
#!/bin/sh
unset PYTHONPATH
/usr/lib/openoffice/program/soffice -writer "$@"


Not sure why the discrepancy. Funnily enough, my /usr/lib/openoffice/program/swriter looks like your oowriter.

No matter, though, as even if I run soffice directly, I get the same result.

Note that soffice itself is a shell script. And it does change directory a few times, but it does change back before executing oosplash.bin. What I'm thinking now is to put some scripts in ~/bin that wrap around the scripts in /usr/bin (which wrap around the script in /usr/lib/openoffice/program, which wraps around the actual executable), and convert any arguments that are relative-path files (using -f) to full-path files.

I think this should work. Save as ~/bin/ooffice (assuming ~/bin is in your PATH before /usr/bin, which, IMNSHO, it should be):

Code:

#!/usr/bin/perl

use strict;
use warnings;

use File::Spec;
use File::Basename;

exec File::Spec->catfile(File::Spec->rootdir(), qw/usr bin/, basename($0)), map {
    -r $_ ? File::Spec->rel2abs($_) : $_
} @ARGV;


(yes, I could probably fit that in fewer lines ...)

Then, from ~/bin, run:

Code:

chmod u+x ooffice
for x in /usr/bin/oo*; do ln -s ooffice $(basename $x); done


This will give an error message about ooffice already existing, but that's to be expected.

And then you may have to run "hash -r" to reset your shell's hash so that "oowriter" (or ooffice or oocalc or whatever) will now resolve to ~/bin instead of /usr/bin.

At least, that's what's working here...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum