indexing
	cluster: "demangler"
	namespace: "candidate"
	description: "A fix for a single error in a `synchronised_directory'."
	original_author: "Justin Finnerty"
	original_date: "October 2005"
	current_date: "$Date: 2005/10/31 07:19:34 $"
	current_author: "$Author: finnerty $"
	revision: "$Revision: 2.1 $"	
	-- $Log: symlink_transform.e,v $
	-- Revision 2.1  2005/10/31 07:19:34  finnerty
	-- Added ability to create symlinks between directories as an alternative to merging. The major changes are in DIRDUP_REPORT with others adding/changing features as required.
	--
	--

class SYMLINK_TRANSFORM
	-- Change name on object in a `synchronised_directory'.

inherit
	TRANSFORM

creation {ANY}
	make

feature {ANY}
	-- Queries on object
	name: UC_STRING is
			-- descriptive label for symlink_transform type (for REPORT_DISPLAY etc)
		once
			!!Result.make_from_utf8 ("Symbolic link")
		end

	remove is
			-- Perform undo operation on virtual directory.
		do
			-- Indicate we are not doable
			previous_transform := Current
		end
	
	to_text: UC_STRING is
			-- concise description of action to perform (for
			-- REPORT_DISPLAY etc).
		do
			!!Result.make_from_utf8 ("Symlink [")
			Result.append_string (m_from_name)
			Result.append_string ("] to target [")
			Result.append_string (m_to_name)
			Result.append_string ("].")
		end

feature {ANY}
	-- Perform symlink_transformations
	do_action is
			-- Perform a corrective operation on a sync_dir. Note that 
			-- we do not create and add a new FILE_SYSTEM_OBJECT for the 
			-- new symlink to the sync_dir. This is probably a BUG!
		do
			sync_report.sync_dir.symlink_to (m_from_name, m_to_name)
		end

	do_undo is
			-- Undo a corrective operation on a sync_dir
		do
			sync_report.sync_dir.unlink_to (m_from_name, m_to_name)
		end

feature {NONE}
	make(a_from_name, a_to_name: STRING; a_report: SYNC_REPORT) is
			-- Make object
		require
			-- a_new_name is valid file name for filesystem
			-- Valid_file_name: is_valid_path (a_new_name)
		do
			!!m_from_name.make_from_string (a_from_name)
			!!m_to_name.make_from_string (a_to_name)
			sync_report := a_report
		end

	m_to_name: STRING

	m_from_name: STRING

end -- class SYMLINK_TRANSFORM
