You are here: PSPad forum > English discussion forum > Re: File Locking

Re: File Locking

Goto Page: Previous1 2 3 4 Next

#11 Re: File Locking

Posted by: dhohmann | Date: 2014-05-22 08:05 | IP: IP Logged

Hello,

the mechanism Multi-Edit uses is a very simple one.

When opening a file the read-only attribute is set - when closing this file the attribute is removed.
When opening a file, that is already read-only then nothing is/can be changed.
Additionally (as in PSPad) you can switch the file-property "read-only" on or off.

Greetings,
Dirk

Options: Reply | Quote | Up ^


#12 Re: File Locking

Posted by: pspad | Date: 2014-05-22 10:39 | IP: IP Logged

Your solution is simple and you can do it manually in PSPad immediately. In program settings set option R/O mode changes file attribute.

But there is same problem as for all locking mechanism:
Imagine there is several people who access to file from different locations.
One of them starts edit file and his connection will be interrupted.

Case 1: he connect again after while, but file is marked as R/O. Is it his old mark or somebody else start edit it already?

Case 2: he can't connect and file stays locked for all, cause they don't know if he still edits or not.

The solution must be more sophisticated. Concept I have in head for it:

1. when you open file, new file with same name and extension is created + e.g. lck extension is added. This file will contains name of user who lock it. Time when the file was locked can be taken from file time.
2. This time will be updated every time the file is saved.
3. This file will be removed when user close file

If his connection will be interrupted and he will connect again, he can open file again, cause lock file contains same name - PSPad knows that nobody else start edit it.

If his connection can't be restored, there can be some timeout (user can set it) how long can be file locked. If there is no release after timeout (e.g.1 hour), user can edit this file.

Advantages of this solution:
PSPad will show information who is working with this file
This solution can be applied over FTP connection too

Options: Reply | Quote | Up ^


#13 Re: File Locking

Posted by: dhohmann | Date: 2014-05-23 16:26 | IP: IP Logged

Hello,

we've tried "R/O mode changes file attribute" already, but we didn't find it useful.

- first of all you would have to manually "Set document as ReadOnly" every time you open a file to make changes - from my experience spoken: that will never work (at least in our company it won't!)

- maybe we have some settings done wrong, but the user HIM/HERSELF, who switches "Set document as ReadOnly" on, can NOT make changes on the file!

The idea we had would be a setting that works this way:

open file NN:
-> file is R/O
-> no changes, don't allow to work on file
-> file is not R/O
-> automatically set R/O attribute on disk, but allow to work

close file NN:
-> file was R/O when opened
-> no changes
-> file was not R/O when opened
-> remove R/O attribute and write file

Mistakenly locked files are a minor problem for us.

Sounds not very smart, I know, but that would be a simple but very useful solution for us - and hopefully easy to implement for you!

Greetings,
Dirk

P.S.
Don't get me wrong: the solution you proposed sounds very good!

Options: Reply | Quote | Up ^


#14 Re: File Locking

Posted by: pspad | Date: 2014-06-12 12:13 | IP: IP Logged

I decided to implement both method of file locking.
Next build should contains method using new LCK file and lock using R/O attribute (set when open and remove when close file).

In the program settings / Tools you will be able activate one of methods.

It will be initial implementation and I guess there will be lot of additional ideas.

Options: Reply | Quote | Up ^


#15 Re: File Locking

Posted by: dhohmann | Date: 2014-07-31 15:34 | IP: IP Logged

Hello,

we tested the file locking mechanism in version 2485 and it worked the way we wanted it to.

So thank you very much and sorry for my late response.

Greetings,
Dirk

Options: Reply | Quote | Up ^


#16 Re: File Locking

Posted by: pspad | Date: 2014-07-31 16:14 | IP: IP Logged

Hello

Thank you for your confirmation

Options: Reply | Quote | Up ^


#17 Re: File Locking

Posted by: lukasz.r | Date: 2015-01-22 08:25 | IP: IP Logged

Hello everyone,

Unfortunately this doesn't work for me. I tested both options (with R/O and with LCK file) on two computers and none of them worked. Do I do something wrong?

I really need this option because I remotely work with graphic side of web service (styling with css) while programmer makes some changes with scripts. And I had two moments when my work was lost beacause of overwritten files.

My operating systems: Windows XP Home SP3 and Windows Vista Business.

Greetings,
Łukasz

Options: Reply | Quote | Up ^


#18 Re: File Locking

Posted by: pspad | Date: 2015-01-22 08:55 | IP: IP Logged

lukasz.r:
Unfortunately this doesn't work for me. I tested both options (with R/O and with LCK file) on two computers and none of them worked. Do I do something wrong?

Hello Lukas
It's hard to answer because you didn't write any details.

I suppose shared drive (not FTP) with write access for botch users (from both computers)
Set both PSpad same file system - I suggest you LCK file

When first computer opens file, PSPad will create same file with LCK extension on the same place as original file.
When second computer opens same file, it got message, that file is edited by computer/user and isn't possible to switch off read only mode - isn't possible to edit file up to file is closed on first computer - closing file in PSPad deletes LCK file.

What doesn't work for you?

Options: Reply | Quote | Up ^


#19 Re: File Locking

Posted by: lukasz.r | Date: 2015-01-23 10:00 | IP: IP Logged

Thank you for your reply.

The details:
Me and programmer work remotely from two cities with the same files placed on FTP (live). We are not working on the shared drive. Twice he had overwritten files which I have been working with because they are not been locked for him. It seemed we had old versions of PSPad without File locking.

I updated PSPad and set up File locking option. I tested it on my two computers with the same version of PSPad with File locking system on. And I found out the file with lck extension doesn't appear when I edit some file on ftp. I could also overwrite the same file from the second computer at the same time so it seems the File locking option doesn't work in my case. I tried both: Lock file with R/O atrtribute and Smart file locking with LCK file.

Is there any option I should also set to on to make it work?

Greetings,
Łukasz

Options: Reply | Quote | Up ^


#20 Re: File Locking

Posted by: pspad | Date: 2015-01-23 11:44 | IP: IP Logged

File locking on FTP is planned, so there is no option to use it yet.
You can use some soft, what will map your FTP as drive. In this case file locking will work for you.

Options: Reply | Quote | Up ^


Goto Page: Previous1 2 3 4 Next





Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR