Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • developement_1 protected
  • Version_1.2.4
  • Version_1.2.3
  • Version_1.2.2
  • Version_1.2.1
  • Version_1.2.0
  • Version_1.0.1
  • Version_1.0.0
  • Version_0.1.0
  • Version_0.0.6
  • Version_0.0.5
  • Version_0.0.4
  • Version_0.0.3
  • Version_0.0.2
  • Version_0.0.1
16 results

VertexTextureShader.mv2shdr

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    fileCompare.m 1.55 KiB
    function [status, id] = fileCompare(filename,fileList)
    %fileCompare checks if file1 is (binary) identical to a file in filelist
    % it returns a sttus and the id of the identical file
    % the function uses the windows system function fc or the unix function
    % diff
    
    if isempty(fileList)
       % no comparison necessary
        status =false;
        id = 0;
        return
    end
    
    [~,~,ext1] = fileparts(filename); 
    id = zeros(height(fileList),1);
    
    for i=1:height(fileList)
        [~,~,ext2] = fileparts(fileList{i,'name'});
    
        if ~isequal(ext1,ext2)
            %warning('File extension are not identical');
            status = false;
            continue
        end
    
        filepath = fullfile(fileList{i,'folder'},fileList{i,'name'});
        
    
        %% old
        %crucial performance due to matlab bug 
        %(see
        %https://de.mathworks.com/matlabcentral/answers/338553-performance-of-system-dos-function)
        if ispc
            filename = ['"',filename,'"'];% Bugfix for spaces in path
            [status,~] = system(['fc ' filename ' ' char(filepath)]);
            % 0 -> identical, 1 -> not identical
             status = ~status; % false (not identical), true(identical)
                       
        elseif isunix %untested!
            [status,~] = system(['diff ' filename ' ' filepath]);
        else
            warning('Platform not supported')
        end
        %%
        
        if status == 1        
            id(i) = 1;
            id =logical(id); %bugfix
            return;
        else 
            % Status can also be any other number e.g. 2 
            id(i) = 0;
        end
        
        id =logical(id); %bugfix
    end
    
    end