Error when saving to a mapped drive in Sublime only: cannot save a file with a user-mapped section open

…衆ロ難τιáo~ 提交于 2021-01-07 11:24:35

问题


When I try to save a file in sublime from a mapped network drive I get an error:

Unable to save Y:\MySite\index.html
Error: The requested operation cannot be performed on a file with a user-mapped section

This error does not happen in Notepad, and is coming from Sublime Text rather than windows, which makes me think Sublime is trying to do something funky during the save process.

What I've tried:

  • The file is open somewhere else. No, I can save the file in Notepad.

  • There may be an issue with user permissions Maybe, however I'm not sure how to fix it.
    The linked post is not specific. I shared the folder by

    Right-Click > Properties > Sharing > Share, added "Everyone", and gave them "Read/Write" permission.

    Could it be that "Everyone" doesn't cover the Sublime user? (Note: I have tried to run sublime as admin, to no avail)


More Details:

Environment:

  • My local computer ("The Host") hosts a Windows 7 Virtual Machine ("The Guest"), which is running Jetty
  • Jetty serves folders from webapps as web servers
  • I set up webapps to be shared with Everyone
  • On the host I mapped webapps so I can edit files locally.

Here's a pic of my Network Folder setup:

The Issue:

When I locally edit a webapps file in Sublime, and Jetty is running in the guest, I get this error when I try to save it:

However, if I edit the same file in Notepad it works fine.


This seems like a Sublime error rather than a windows error, meaning it's perhaps trying to do something funky with the file rather than saving it. Has anyone else experienced this?


回答1:


Thanks to Joakim Erdfelt's answer to my other question I got this figured out!

This is an issue with windows' memory buffering, but you can fix it in a Jetty config file. See the docs for more info. Here's what I did:

  1. Find your webdefault.xml file.

    • Mine was in C:\Place_where_Jetty_was_installed\Jetty\etc\
  2. Open it and search for UseFileMappedBuffer. Look for this:

    <init-param>
      <param-name>useFileMappedBuffer</param-name>
      <param-value>true</param-value>
    </init-param>
    
  3. Set param-value to false

    <param-value>false</param-value>
    


来源:https://stackoverflow.com/questions/44951483/error-when-saving-to-a-mapped-drive-in-sublime-only-cannot-save-a-file-with-a-u

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!