Community
    • Login

    Write access forbidden

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    12 Posts 3 Posters 685 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Tobias DietrichT
      Tobias Dietrich
      last edited by

      Is it possible in notepad++ to set an option that I can´t open the same file with write access.
      In microsoft word if I want to open the same file twice I will get an message that the file is already opened.
      We have the problem that several persons edit one file with notepad++. I will get an message if an other person has opened the file already.

      Please can you help me?

      1 Reply Last reply Reply Quote 0
      • rinku singhR
        rinku singh
        last edited by

        at this time are you seeking a plugin or script who notify if file has already opened in npp or another editor ?

        1 Reply Last reply Reply Quote 0
        • Tobias DietrichT
          Tobias Dietrich
          last edited by

          Yes an plugin or if there is any setting to change this.

          1 Reply Last reply Reply Quote 0
          • rinku singhR
            rinku singh
            last edited by

            document list panel can show you file has set as read only

            setting > preference > general > document list panel

            1 Reply Last reply Reply Quote 0
            • Tobias DietrichT
              Tobias Dietrich
              last edited by

              With document list panel I can´t see that the file is already opened by an other user.

              1 Reply Last reply Reply Quote 0
              • rinku singhR
                rinku singh
                last edited by

                yes i have c# code for write a plugin for notify if file in use (file is busy) but not sure it works file who in use by other user

                protected virtual bool IsFileLocked(FileInfo file)
                {
                    FileStream stream = null;
                
                    try
                    {
                        stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.None);
                    }
                    catch (IOException)
                    {
                        //the file is unavailable because it is:
                        //still being written to
                        //or being processed by another thread
                        //or does not exist (has already been processed)
                        return true;
                    }
                    finally
                    {
                        if (stream != null)
                            stream.Close();
                    }
                
                    //file is not locked
                    return false;
                }
                
                1 Reply Last reply Reply Quote 0
                • Tobias DietrichT
                  Tobias Dietrich
                  last edited by

                  I don´t know, how I import this code as plugin.

                  1 Reply Last reply Reply Quote 0
                  • rinku singhR
                    rinku singh
                    last edited by

                    file is just not busy by npp

                    1 Reply Last reply Reply Quote 0
                    • Tobias DietrichT
                      Tobias Dietrich
                      last edited by

                      I don´t know what I should do with this c# code.

                      1 Reply Last reply Reply Quote 0
                      • pnedevP
                        pnedev
                        last edited by

                        @Tobias-Dietrich ,

                        Currently you cannot know that another person has already opened the file.
                        It is because the file is kept open for a very short time (only when reading it or writing it) and then it is immediately closed.

                        BR

                        1 Reply Last reply Reply Quote 2
                        • Tobias DietrichT
                          Tobias Dietrich
                          last edited by

                          Ok many thanks for your answer. I know that other editors can lock this file during it is in use.
                          Is that option planned for development?

                          1 Reply Last reply Reply Quote 0
                          • pnedevP
                            pnedev
                            last edited by pnedev

                            I don’t know but I don’t think so.
                            You can file a feature request here if you like:
                            https://github.com/notepad-plus-plus/notepad-plus-plus/issues

                            BR

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            The Community of users of the Notepad++ text editor.
                            Powered by NodeBB | Contributors