Prevent save on patch


#1

Hi, i need to prevent patch from saving, and to suppress save dialog on that patch.

Mark as readonly did’t help for some reason, patch just getting overwritten without readonly flag anymore…

Any more ideas?


#2

This is dirty as hell but what if you set the readonly flag from a C# plugin ? Just for testing purposes, definitely not a proper solution :)

#region usings
using System;
using System.ComponentModel.Composition;

using VVVV.PluginInterfaces.V1;
using System.IO;
using VVVV.PluginInterfaces.V2;
using VVVV.Utils.VColor;
using VVVV.Utils.VMath;

using VVVV.Core.Logging;
#endregion usings

namespace VVVV.Nodes
{
	#region PluginInfo
	[PluginInfo(Name = "SetReadonly", Category = "File", AutoEvaluate = true)]
	#endregion PluginInfo
	public class FileSetReadonlyNode : IPluginEvaluate
	{
		#region fields & pins
		[Input("Path", StringType = StringType.Filename)]
		public ISpread<string> FPathIn;
		
		[Input("Set Readonly")]
		public ISpread<bool> FSetIn;

		[Output("Output")]
		public ISpread<double> FOutput;

		[Import()]
		public ILogger FLogger;
		#endregion fields & pins

		//called when data for any output pin is requested
		public void Evaluate(int SpreadMax)
		{
			FOutput.SliceCount = SpreadMax;
			
			if(FSetIn[0])
			{
				File.SetAttributes(FPathIn[0], FileAttributes.ReadOnly);
			}
			else
			{
				File.SetAttributes(FPathIn[0], ~FileAttributes.ReadOnly);
			}
		}
	}
}

Works here !


#3

Self (VVVV) should help with this.


#4

Hmm seems Query Save 0 on self node did actually started to prevent patch from saving even without SetReadonly flag

The plug makes file hidden without way to unhide it hehe

the answer was quite plane easy hehe


#5

Query Save disable only prevents the save dialog popping up, forceful saving still overwrites though