Skip to content
Snippets Groups Projects
Select Git revision
  • 7aa75221bca73832a3b16e9813c5fc52c0e8a22c
  • main default protected
  • dev protected
  • Issue/3142-kpiGenerator
  • Hotfix/3115-userReportingEmpty2
  • Hotfix/3115-userReportingEmpty
  • Issue/3043-DataStorageNrwResource
  • Issue/3011-maintenanceMode
  • Issue/2492-respOrg
  • Issue/2446-addingResponsibleOrganization
  • Issue/2982-kpiDataPub
  • Issue/2981-dataPubInDb
  • Issue/2881-messageController
  • test-linux-pipelines
  • Issue/2944-gdShenanigans
  • Issue/2672-fixSfbPidPointing
  • Issue/2769-migrateCron
  • Issue/2668-graphDeployer
  • Issue/2847-reporting
  • Issue/2627-addPidRecord
  • Issue/2432-publicationKpi
  • v1.9.10
  • v1.9.9
  • v1.9.8
  • v1.9.7
  • v1.9.6
  • v1.9.5
  • v1.9.4
  • v1.9.3
  • v1.9.2
  • v1.9.1
  • v1.9.0
  • v1.8.0
  • v1.7.0
  • v1.6.0
  • v1.5.0
  • v1.4.0
  • v1.3.3
  • v1.3.2
  • v1.3.1
  • v1.3.0
41 results

ActivityLogDtoTests.cs

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