Forum > FV/Textmode IDE

(SOLVED) Weird behavior opening a text file in FV editor

(1/3) > >>

HotShoe:
I am playing around with the idea of replacing an Ncurses editor that has been around for many years (since 1986). I haven't really messed with Borlands TV or fpc's FV packages, so I grabbed the demo and started modifying it.

It looks much better than the old Ncurses one so I started putting in the features that I wanted while doing tests along the way. I am doing this on a Rysen 7 laptop with 32G of memory running KDE Neon (based on ubuntu Linux) and the latest 3.6 lazarus/fpc packages from this site.

When I tried to open a file in /etc to make sure that paths were being passed correctly, I got an error reading file (error 5- IO error). The file was /etc/fpc.cfg which has permissions of 644 (rw-r-r) I can open this file with any other text editor but not with this one. I dug into the editors module source to see if it was wanting my user as the file owner, but that isn't the case (the file is owned by root).

The error happens as soon as the Reset command is executed. It uses the System units reset command which just calls opentext with FMInput, which is correct and what I want. I know reset works fine, so why can't I load this file? I created a new junk text file as root, then did a chmod 644 on it in the projects directory with the same results. I can chmod the file to 666 and it loads just fine. I need an editor to load any text file that the user has permissions to read.

I don't see where or why this is happening and it doesn't happen if I open a file in a straight console program or my old ncurses editor. What am I missing here?

Thanks,
--- Jem

cdbc:
Hi
It might be that FV-editor start by creating a ~working-copy in the same directory, like e.g.: 'gedit' does?!? I dunno...
Just my guess.
Benny

HotShoe:
That would certainly cause an error. I'll see if it is trying to create a "work" file, but the junk file I created was in the editors project dir which I have full access to.

Thanks,
--- Jem

Thaddy:
Can you open it readonly? (meaning Filemode:=0, default is 2, rw) With filemode = 0 reset should succeed. It is a simple global variable.
It seems that something goes wrong in the default file mode, because that tries rw on a r only file.

TRon:
@HotShoe:
In case you require such finer detailed access rights it might perhaps not be a good idea to use the oldschool file-handling approach but instead switch to something that allows for these details to be controlled.

Thaddy is right in that you can manipulate things... a little but, it is up to a certain point.

If all else fail you could even fall back to using *nix api to access files (usually not required though).

Navigation

[0] Message Index

[#] Next page

Go to full version